Charts and R scripts
Charts
Most analyses draw a chart with R's ggplot2. Under the chart you can change:
- Chart type: box plot with points, bars with error bars, interaction plot, scatter plot with the fitted line, or power curve, depending on the analysis.
- Title and axis labels.
- Color, theme (classic for journals, or minimal), and text size.
Press Update chart to redraw it. Every setting becomes a line in the R script, so the chart in your exported script matches the one on screen. To save a picture, press Download chart (PNG).
Bars show the mean ± one standard error for measurements, and the estimate with its confidence interval for yes/no, count, and score models.
The R script
Open Show the script to see the exact R code aStat ran. The script it shows is the script it ran: aStat adds only a separate step that collects the results for the screen, and that step never changes a number.
The script:
- lists the packages it needs, with the line to install them;
- reads your data file and stops with a clear message if a column is missing;
- is split into numbered, commented sections;
- uses short R names for your columns, while labels and tables keep your own names.
Re-running the script in R
- Install R (4.3 or later) and, if you like, RStudio.
- Press Download .R and keep the script in the same folder as your data file.
- If you edited the sheet in aStat, also press Download edited data. The script then reads
yourfile_edited.csv, so it reproduces exactly what you saw. - Run the
install.packages(...)line at the top once, then run the whole script.
Small last-digit differences can appear between R versions or package versions; the conclusions do not change.
Why the script matters
Reviewers, advisors, and your future self can see exactly what was done. A methods section can say: "Data were analyzed in R (version) using the script in the supplementary material." The FAQ has a citation for aStat.