Abstract
The use of single-subject research designs is common among behavior analysts, as well as among other professionals interested in the study of behavior. Although there are clear guidelines for creating graphs to represent data collected with these designs, the type of tools used to produce them requires considerable time and effort to cover the specific criteria to plot data for each type of design and always involves the purchase of a software’s license. This manuscript describes four functions created in R language to automatically produce plots with specific characteristics for data collected using single-subject experimental designs. These functions were included in a package created in R to facilitate their sharing, installation, and use (R package for data analysis and representation in behavior science, https://github.com/ruizvja/RDARBS). The application of these functions is exemplified for the cases of reversal design, multi-element design, changing criteria, and multiple baseline. The relevance and convenience of functions is illustrated and discussed in the context of other proposals that have been made for the specialized production of plots for single-subject research designs.
Keywords: Single-subject designs, Plots, Algorithms, R-package
This paper is directed toward professionals who are interested in the use of single-subject research designs as their primary method of assessing behavioral change. In this context, it is important to note that there are various bibliographic sources that accurately describe the characteristics of so-called single-subject designs, from chapters in behavior modification textbooks (e.g., Martin & Pear, 2019; Miltenberger, 2023), to complete specialized works on the subject (e.g., Barker et al., 2011; Barlow et al., 1984; Kazdin, 1982; Morley et al., 2018; Riley-Tillman et al., 2020). Such descriptions refer mainly to the phases and conditions characteristic of four common single-subject research designs: reversal design, changing criteria, alternating treatments (or multi-element), and multiple baseline.
Over the years, there have been a number of contributions focused on the development of particular procedures for producing representations of the data collected using single-subject research designs. The contribution of Carr and Burkholder (1998), to create graphs for this type of design using Microsoft Excel®, is considered the starting point for this type of contribution. Over time, the characteristics of the software used by these authors changed and with this it was necessary to make some adjustments to the original indications to build the graphs using Microsoft Excel® (e.g., Dixon et al., 2009; Pritchard, 2008). Recently, other proposals have been presented with the same goal, using other computer programs that are also useful for creating graphs. For example, by using Google Sheets and Google Slides (Blair & Mahoney, 2022) or by using Graphpad Prism (Mitteer et al., 2018).
Since the number of bibliographical sources that offer a guide on the criteria that the graphs must cover for single-subject designs is extensive, it is possible to find a series of criteria that are common throughout the literature. Figure 1 shows two graphs, one corresponding to an ABA reversal design (upper panel) and the other to an alternating treatment design (lower panel), which show data generated from a computer simulation. Data plotted in each graph are not important (because they are simulated), what is relevant in this figure is the exemplification of common criteria that appear in different sources consulted on the representation of behavioral change. Those criteria have been identified as part of the essential structure and quality features for graphic presentation using line graphs (Kubina et al., 2015). Other aspects that are not explicitly indicated in the figure but that deserve special mention are: the use of an x/y ratio of 2:3 for an adequate representation of the values recorded over time (Cooper et al., 2020; Kubina et al., 2015), as well as the indication of a minimum of three baseline conditions in multiple-baseline designs and changing criterion designs with at least three different criteria (Gast et al., 2018; Kratochwill et al., 2010, 2012; Lanovaz & Turgeon, 2020).
Fig. 1.
Recommended attributes for creating graphs for single-subject research designs. Note: A graph for a reversal design is exemplified in the upper panel and one for an alternating treatments design in the lower panel. The text-boxes contain the label of the desirable attributes that are indicated on each graph
It is relatively easy to use spreadsheets and similar computer programs to create single-subject design graphs, some of the peculiarities illustrated in Fig. 1 show that their applicability to the specific case of plots for evaluation of behavioral change is not so direct. For example, for building a plot for reversal designs, a spreadsheet must be created in which data of each phase is placed in separate columns inserting empty rows between rows with data to achieve the effect of continuity through the sessions, whereas breaks in data series (and sometimes symbol change) between one phase and another are plotted (e.g., Carr & Burkholder, 1998). Even relatively simple details such as inserting vertical lines to separate data from one phase to another takes extra time to ensure that, when there is one or more lines, they are the same length and perfectly oriented (e.g., Blair & Mahoney, 2022). The amount of time and effort required on this type of detail for each plot can be seen in the descriptions made by different authors who have offered guides or tutorials to make this type of figure (Berkman et al., 2018; Blair & Mahoney, 2022; Carr & Burkholder, 1998; Dixon et al., 2009; Dubuque, 2015; Fuller & Dubuque, 2018; Kubina et al., 2015; Pritchard, 2008; Vanselow & Bourret, 2012).
Another limitation is that common spreadsheet software usually has a cost, whether it involves paying for a term or a perpetual license. For example, at the time of writing this paper, the cost of a Microsoft 365 Personal license was $6.99 per month, or $69.99 for an annual payment (Microsoft, 2024). In the case of Graphpad Prism, the cheapest licenses are the Individual Student license at $142.00 per year and Academic license at $202.00 per year (Dotmatics, 2024). It is likely that not everyone will be able to purchase one of these licenses on their own.
In this context, the availability of free and open-source software increases the possibility of developing applications for specific uses without an elevated cost. One example of those uses is the creation of algorithms that make the process of producing graphics with specific characteristics more efficient. Although it is not a unique condition of the software used in this work, it is important to highlight the possibility of creating packages that integrate the algorithms developed for specific uses and being able to share freely with the community of possible users. Any user can also make adjustments to the code according to their particular needs.
A Brief Introduction to R
R is free, open-source software commonly used to perform statistical analyses and visualizations, among other uses (Ihaka & Gentleman, 1996). R is also a versatile language for programming particular techniques and procedures (Wickham, 2019), and can operate in Linux, MacOS, and Windows platforms. A lot of authors have described some general and specific characteristics of this software and the way in which it is programmed (see, for example, the book series Use R!, https://www.springer.com/series/6991/books). Any reader is recommended to go to the official site of the Comprehensive R Archive Network (CRAN, https://www.R-project.org) for programming details and introductory tutorials and documents (e.g., Paradis, 2005).
We describe a series of functions created from the R language designed to represent data from each of the four single-subject research designs mentioned above and saved together with other functions in the package RDARBS (R package for data analysis and representation in behavior science). Nevertheless, before going into detail regarding the characteristics and usefulness of these functions, we consider it appropriate to make a brief guide on the installation of the software, as well as about the basic grammar of this programming language.
Regarding that functions described in this work were developed using RStudio editor and that it is in itself very useful when programming in R, we describe a series of steps to download and install both, R and RStudio. First of all, the user must go to the RStudio download page (https://posit.co/download/RStudio-desktop/), where they will find the corresponding links to download the R installation file as well as the link to download RStudio installation file. By clicking on the corresponding R link (“1: Install R”) the user will be redirected to RStudio mirror of CRAN (https://cran.rstudio.com/) where it will be possible to select the specific installation file in accordance with the operating system of the user’s computer. For example, the user can click on the link “Download R for Windows” (https://cran.RStudio.com/bin/windows/), and then click on the option “Install R for the first time” (https://cran.rstudio.com/bin/windows/base/), and will be redirected to the page where the updated version of the software is available (https://cran.rstudio.com/bin/windows/base/R-4.30.3-win.exe). In this page you will find important information about the software, for example, the README file or the frequently asked questions. Once the file has been downloaded, the installation procedure is similar to installing any other executable file.
Once R is installed, the user can use the console of this program, which could represent the least viable option for someone who is beginning in the world of R programming. Instead, there is the possibility of using RStudio to code in a more user-friendly environment, particularly because it makes explicit various functions of R that in the case of using only the R console are not evident and that could result in a slow learning curve for someone with no experience.
To download the RStudio installation file, you must click on the corresponding option “2: Install RStudio” from the page https://posit.co/download/RStudio-desktop/ and the file for Windows will be automatically downloaded. If the user requires a version for a different operating system, they can browse in the list shown in the same download page. The user must run the file and follow the prompts during the installation process.
Once both files have been installed, the user simply needs to run RStudio and it will automatically link to the R console. Figure 2 shows a screenshot of the appearance of the RStudio graphical user interface when it is started the first time. Actually, the screen is divided into three main planes, but this figure shows four in order to illustrate what is seen after the first step to code in R, that is, opening a new R script file (go to File tab > New File > R script). At the top left, there is the window for writing commands or scripting sets of commands to perform a task. On the left below, the R console is shown, here is where tasks coded in the script window are executed. Tasks can also be written directly in the console window. At the bottom right, a window is shown with several important tabs, the first four allow you to view the files available in the working directory linked to R (by default, the Documents folder), the installed packages (active or inactive) in the R environment, the graphics that are produced by the code when it is executed, as well as the documentation for each package and functions installed in the R environment. At the top right, a window is shown in which the first two tabs are particularly helpful when programming in R, the Environment tab is where any object created in the programming environment is displayed, either by importing an external file or as a result of the execution of some programmed instruction, and the History tab that shows the work history. For a more detail description and documentation of RStudio, visit the page https://docs.posit.co/.
Fig. 2.
Screenshot of RStudio graphical user interface. Note: Working area is divided into four planes: coding area (top left), R console (bottom left), area of information about files in working directory, installed packages, plots, and help (bottom right), and area of description of objects within the Environment and history of working in R
R is a language that works from command lines that are essentially built from two parts: objects and functions, joined by the symbol “ < -” (which means “created from”). An object in R can take a specific value (e.g., a constant), a variable (numeric, logical, categorical, etc.), a set of variables (of the same or a different type), a complete data set, among others cases. A function in R is any possible operation on objects. The sources of R functions are the base and others packages included automatically at the moment of software installation and from packages manually downloaded and installed by the user (such as the one described here).
Figure 3 shows an example that the reader (and potential user) could run on their own computer as an introductory practice to using R. When writing and executing the first line, the program does not return a result in the R console, although it does in the Environment tab, in which an object (example1) created from the concatenation of the values 1, 2, 3, 4, and 5 now appears. In the same way in which this object has been created, you can create any other. In the next section, we illustrate how an object can be created importing a complete data set from an external file. Once an object exists in the R environment, functions can be executed using that object. The type of actions that can be carried out over an object depends on the characteristics of it, for example, whether it contains a single value or a set of values, or whether they are numerical, categorical, or another type of values. The second line exemplifies the calculation of the arithmetic mean of the values concatenated in the object example1 and shows the result that appears in the R console in the line that begins with the symbols ##, that is, the mean is 3. If the result of the application of a function would like to be saved in an object, the same logic must be used as in the case of creating example1. The third command line exemplifies one of the most used functions in R for creating plots. In this figure, we show the simplest situation in which a graph can be requested. It can be seen that data is plotted considering some aspects automatically, such as the type of plot (as a scatterplot), the name of the object that contains plotted data is assigned as the label for the Y axis, while the position index of each value on the X axis is used with the label “Index” by default. The plot() function allows the inclusion of different arguments that allow customizing the attributes of graphs, for example, the type of graph, the size of plotting symbols, the number of data series, among others. In the following section, we describe the type of arguments that can be included in the plot() function to customize some attributes in a plot for single-subject research designs.
Fig. 3.
Example of coding in R. Note: Each line of code has the same general structure: object < -function(), which can be used for assign data to objects, execute specific functions on data, and plot data, among others examples
RDARBS Package
The functions described below were created with version R 4.3.0, using the editor RStudio 2023.06.0 (RStudio Team, 2024). For the creation of the functions to build the graphics, the R Base (R Core Team, 2024) was used, and for the design and creation of the package that contains them, the packages devtools (Wickham et al., 2022b) and roxygen2 (Wickham et al., 2022a) were used. The RDARBS package can be downloaded and installed from the R console or in RStudio using the following commands: devtools::install_github(“ruizvja/RDARBS”). It contains other functions to plot behavioral data through time (for example, to plot data from continuous observational studies), to plot cumulative records of responses recorded throughout the experimental sessions, and some tools for the analysis of continuous properties of behavior as a function of stimuli occurrences in time and space (for example, to plot X–Y routes of displacement of animals in experimental spaces or mouse routes in computer tasks with humans). In this paper, we described only the functions to plot data from single-subject research designs; however, the use of the other functions has been exemplified in other works (e.g., Ribes-Iñesta & Ruiz, 2021; Ribes-Iñesta et al., 2022; Ruiz et al., 2022).
The users of this R package can create and store data sets using their preferred software; it can be a simple text file (e.g., using Notepad) or a file generated using any spreadsheet (e.g., Microsoft Excel or Google Sheets) and even specialized software for data analysis (e.g., SPSS, Stata, SAS, Systat, among others). Using the appropriate R package, data can be imported from a file practically with any type of extension.
To use any of the functions described in this work, a data set must be created with a particular organization, regardless of the program used to create the file containing data (e.g., Microsoft Excel, Notepad, SPSS). Figure 4 shows an example of data set configuration for each type of research design. In all cases, the data set must include at least three columns: one to indicate the sessions or days of data recording (column Session), another for the value recorded in each session (column Measure), and one more to indicate the corresponding phase (e.g., baseline or intervention) of each session (column Phase). That is, each row must include the day or session of data collection, the registered data, and the current phase for that day. Except for reversal design (Panel A), other columns must be added, in which the scenario, behavior, or participant is introduced, in the case of the multiple baseline design (e.g., column Case in Panel B); the current criteria in each phase of a changing criteria design (e.g., column Criteria in Panel C); or one of the multiple treatments that alternate in each phase of the alternating treatment design (e.g., column Treatment in Panel D). In the case of Panel A, the data is the same with which Carr and Burkholder (1998) illustrated the procedure for producing a graph for this type of design in Microsoft Excel®. In the rest of the cases, data were generated from computer simulations.
Fig. 4.
Examples of data set configuration for each type of design. Note: The recommended organization of the relevant variables is shown for plotting data from a reversal design (A), a multiple baseline design (B), a changing criterion design (C), and an alternating treatments design (D)
Depending on the extension of the data file, it may or may not be necessary to activate a particular package (or install it, in case it has not been installed before). For example, to import data from *.txt files the read.table() function from utils package (R Core Team, 2023) can be used, without the need to activate this package, since this is one of several that are automatically activated when starting each work session. To import files with the *.xlsx extension, it may be necessary to install a package such as readxl (Wickham & Bryan, 2023), of which the read_excel() function allows you to import a complete Excel workbook or a specific sheet contained in the file (or even a specific range of cells in a sheet). The documentation of any installed package can be consulted writing the package name in the search field of the Help tab mentioned before or by executing the function help() in the R console (with the package name between the parentheses). It is important to view the documentation of the function used to know the type of arguments that specify the details of its operation.
Data shown in Fig. 4 and used for illustrating the functions of the RDARBS package for single-subject research designs are included in the package contents. Therefore,, the examples of plots in Figs. 5, 6, 7, and 8 can be replicated directly by executing the lines of code presented below regarding each type of research design. Nevertheless, it is important to show how to import data from external files, for example, with *.txt or *.xlsx extensions. It is very probable that most users save their collected data in files with one of these extensions. For data in *.txt files, the basic structure of function is read.table(file, header, sep). The file argument refers to the name of the file which the data are to be read from (in the example, file path is included to specify the location of file); header argument must be TRUE if the first row contains the names of each column (i.e., names for each variable in data frame); and sep argument indicates the character used as separator of values in each row (in this case values are tab-separated, other common characters used as separator are “,”, “;”, and “”). For data in *.xlsx files, the basic structure of a function is read_excel(file, sheet, col_names). The file argument refers to the name of the file which the data are to be read from; sheet argument indicates the specific sheet where data are; and col_names argument must be TRUE if the first row contains the names of each column.
Fig. 5.

Example plot for an ABAB reversal design. Note: Data used by Carr and Burkholder (1998) in their example of ABAB design are shown, corresponding to the recording of behavior through four consecutive phases, Baseline 1 (BL 1), Intervention 1 (IV 1), Baseline 2 (BL 2), Intervention 2 (IV 2)
Fig. 6.

Example plot for a multiple baseline design. Note: Data generated by simulation are shown, corresponding to the recording of behavior of three cases through two consecutive phases, baseline (BL), and intervention (IV)
Fig. 7.

Example plot for a changing criterion design. Note: Data generated by simulation are shown, corresponding to the recording of behavior through three consecutive phases each with a different criterion (Crit 1, Crit 2, and Crit 3)
Fig. 8.

Example plot for an alternating treatments design. Note: Data generated by simulation are shown, corresponding to the recording of behavior through three consecutive phases, with baseline (BL) conditions in Phase 1, two alternating treatments in Phase 2 (IV 1 and IV 2), and only one treatment (IV 2) in Phase 3
The first and second lines of the next paragraph illustrate the installation of an R package and its activation. The installation of any package should only be done the first time the package is used, while activation should be done in each new session in which the package is intended to be used. An important note is that most packages installed by R programmers are downloaded using the function install.packages() directly from CRAN. It is common to use repositories in which the source code to build and use a package which is not in the CRAN (because the package is still in development). So, the devtools package is needed for the installation of the RDARBS package from the repository. The third and fourth lines of the following paragraph illustrate the installation of the RDARBS package from the Github repository and their activation.
Reversal Design
For the reversal design, the proposed function has the form: plot_Reversal(time, dimension, phase, symbol = 18, type = ”o”, xlab = "x", ylab = "y", legend = "Subject",xdiv = 0,ylim = NULL). Where time corresponds to the variable in which the session number is included, dimension to the collected data and phase to the current phase for each observation. The arguments symbol, type, xlab, ylab, and legend, have as predefined values the number and labels that appear between quotes and can be modified by the user before running the function. Symbol can take any acceptable numerical value for the pch parameter in the plot function from the base package in R (it is suggested to review the documentation to know the correspondence between numbers and symbols). type can take any acceptable value in R to indicate the type of graph that is produced, by default it is assigned "o" to overlap lines and points to plot the data series (using “b” prevents lines overlapping points); xlab and ylab, correspond to the labels of the abscissa and ordinate axis, respectively. legend corresponds to the label to identify the subject. xdiv has a default value of 0 to draw a tick mark for every data in time (i.e., for every day, session, etc.), a different value results in the assignation of a specific number of tick marks and the xdiv−1 corresponding intervals in the x-axis. ylim sets the upper limit of the y-axis; by default, NULL value sets the limit in the next ten with respect to the maximum in dimension variable.
Figure 5 shows the case of reversal design using the data set illustrated in Panel A of Fig. 4. In a previous example of code, this data set was saved in the object reversal. Because the object contains a complete data set, it is necessary to specify what column corresponds to each variable in the call of plot_Reversal() function using the format “object$column”. Following lines of code illustrate the use of reversal$Session, reversal$Measure and reversal$Phase corresponding to the arguments time, dimension, and phase, respectively. The number 18 in symbol argument corresponds to filled diamonds. With type = ”o”, lines and points are overlapped. Labels for axes and the legend where the text is defined by default. User can change the number in symbol to use another plotting character and can change the labels for x and y axes, as well as for the subject.![]()
The function automatically establishes, based on the number and names of the categories that are included in the phase variable, the number of sessions that are included in each phase, the placement of the vertical lines that separate each phase, as well as the labels corresponding to each one of them. The graph in the upper panel of Fig. 1 was also created using this function, the call was as follows (where ABA is the data set name for this example):![]()
Multiple Baseline Design
For multiple baseline design, the proposed function has the form: plot_MBL(time, dimension, case, phase, symbol = 11, type = ”o”,xlab = "x", ylab = "y", xdiv = 0,ylim = NULL). Where the arguments involved have the same function as in the previous case. The additional argument case corresponds to the identification of the scenario, behavior, or subject to which the data of each baseline belongs. In this function, it is not necessary to use the legend argument, since the algorithm identifies in the data set the corresponding labels from the variable indicated for case argument.
Figure 6 shows the plot for a multiple baseline design using the data set illustrated in Panel B of Fig. 2 (saved in the object mbl previously). The function call was as follows:![]()
The function automatically determines, based on the number and names of the categories that are included in the Phase variable (and its crossing with the Case variable), the number of sessions that are included in each phase, the placement of the vertical lines that separate the baseline sessions from the treatment sessions in each case, as well as labels corresponding to each of the phases. In other applications of this function, the user must make sure to design a data set in which the crossing of the values in each variable allows a correct reading of the session number, the magnitude of the measured variable, and the phase to which each observation belongs, for each scenario, behavior, or subject involved in the research design.
Changing Criterion Design
For changing criterion design, the proposed function has the form plot_CC(time, dimension, criteria, phase, symbol = 18, type = ”o”, xlab = "x", ylab = "y", legend = "Subject", xdiv = 0,ylim = NULL). Where the arguments involved have the same function as in the previous cases, while criteria corresponds to the identification of the current criteria in each session.
Figure 7 shows the case of changing criterion design using the data set illustrated in Panel C of Fig. 1 (included as changing in package, and saved with the same name as in previous code). The call of the function was as follows:
The function automatically establishes, based on the number and names of the categories that are included in the phase variable (and its crossing with the Criteria variable), the number of sessions that are included in each phase, the placement of the vertical lines that separate the sessions under each, as well as the labels corresponding to each phase. In other applications of this function, the user must make sure to design a data set in which the crossing of the values in each variable allows a correct reading of the session number, the magnitude of the measured variable and the current phase of each observation, for each of the criteria considered in the research design.
Alternating Treatments Design
For alternating treatments or multielement designs, the proposed function has the form plot_ME(time, dimension, treatment, phase, symbol = c(0,15,19), type = ”o”, xlab = "x", ylab = " y", legend = "Subject",ylim = NULL). Where the arguments involved have the same function as in the previous cases, while treatment corresponds to the designation of the current treatment at a given moment. In this case, symbol argument is predefined with three different plotting characters, one for baseline data and two more for two alternated treatments; however, users can change the quantity of values (and the number for each value) to identify the corresponding number of conditions (i.e., different data series).
Figure 8 shows the case of alternating treatments or multielement design using the data set illustrated in Panel D of Fig. 4 (previously saved in the object multielement). The call of the function was the following:
The function automatically establishes, based on the number and names of the categories that are included in the phase variable, the number of sessions that are included in each phase, the placement of the vertical lines that separate the baseline sessions from those of treatment in each case, as well as the labels corresponding to each one of the phases. In the case of this figure, function legend() must be added to specify the labels for each data series. Although this function accepts more arguments than those shown in the code below, those illustrated allow to establish x–y coordinates to show the legend, to write the labels of data series, to assign the symbols for data series, specify the line type for data series, the title of the legend, the type of font, whether or not the legend will appear framed, as well as the background color of the legend box.
The graph in the lower panel of Fig. 1 was also created using the plot_ME() function, the command was as follows (where ALT is the data set name for this example):
Any user can write RDARBS in the Help tab or execute help(RDARBS) in R console, and then click on the Index link to view the complete documentation of the package. The contents include more specific and technical descriptions of data sets and functions (those described in this paper and others just mentioned), as well as examples of the use of each function and the corresponding plot they produce. An interesting fact about plotting in R is that users can export their plots as simple as clicking on the graph with the right mouse button and selecting the most convenient option between copying and putting it on the clipboard or saving it in an image format file. Another alternative, more suitable for an automatic saving of the graph when the corresponding code is executed, consists in writing the call of plotting function between two independent lines of code, as shown in the following example.
The png() function accepts several arguments, but the first three are enough to indicate the filename to save the image, and the width and height of it. By default, the size is 480 × 480 pixels, but those values and units can be modified by the user. After calling the plot function, the dev.off() function is used to close the image capture of the produced graph (in technical terms, the graphic device is turned off).
Conclusion
The functions shown in this work are useful for the automated production of specialized graphs for data collected through single-subject designs. The only two efforts required are: (a) to ensure that the collected data set is structured with the characteristics exemplified in Fig. 4 and described in the text; and (b) if necessary, learn to use the basic functions of R to import data with the type of extension chosen by the user when capturing their data set.
A good design of data sets is something that is advisable to do in any case, following some basic principles such as organizing each observation in each row and their different attributes through the columns that are necessary to capture all the information for each one. In the scenario of single-subject designs, the ideal is to include each day of observation (or experimentation) through the rows and the measured attributes and indicator variables of the current conditions for each observation through the adjacent columns.
Regarding the possible need to learn how to use R, this should be seen as a one-time investment of time. Once you have a minimum of basic training to import and manipulate data, the functions described here can be applied in a few seconds every time they are required. In contrast, the use of spreadsheet-based programs, while easy to use, take a considerable amount of time to create graphs such as those typically used for single-subject designs (and most have a cost). Likewise, owing to its free distribution and open source, it is an excellent alternative to create data analysis and representation tools for the most specific purposes that the user may have without having to pay for an expensive license.
The creation of packages in R is another advantage that deserves to be highlighted, since they make it possible to store a series of functions that are created for specific purposes and are easy to share with other users who might find them useful. Building the RDARBS package is motivated by the need to have procedures that help make data analysis in behavior science a more efficient process. It is a small part of what scientific work implies, but we consider it opportune to develop tools like these to support the behavior analysts in practice. In this context, it is appropriate to point out that in the R use scene there are an infinite number of functions and packages that can be useful for any behavior analyst, whether to perform exploratory data analysis, to apply statistical tests, or to visualize data in specialized ways. In particular, the fxl package, Faux XL single-case charting package (Gilroy, 2024), represents a more complete and sophisticated alternative than the one described in this work to prepare single-case design figures. The reader is invited to appreciate the quality of the figures produced using the fxl package, such as Fig. 4 in Gilroy et al. (2021), and to see package documentation (https://cran.r-project.org/web/packages/fxl/fxl.pdf) to have complete information about its syntax and examples of figure production.
Author Contributions
All authors contributed to the study conception and design. Material preparation, design, coding, and documentation were performed by all authors. The first draft of the manuscript was written by Jorge A. Ruiz and all authors commented on previous versions of the manuscript. All authors read and approved the final manuscript.
Funding
This work did not receive any specific grant from funding agencies in the public, commercial, or not-for-profit sectors.
Data Availability
Data used to illustrate the use of the functions described in this work were generated by computer simulation and can be accessed, as well as their corresponding documentation, by installing the R package RDARBS created by the authors.
Declarations
Conflict of Interest
The authors declare no conflict of interest.
Footnotes
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
References
- Barker, J., McCarthy, P., Jones, M., & Moran, A. (2011). Single-subject research methods in sport and exercise psychology. Routledge. [Google Scholar]
- Barlow, D. H., Hersen, M., Hartmann, D. P., & Kazdin, A. E. (1984). Single case experimental designs: Strategies for studying behavior change. Pergamon. [Google Scholar]
- Berkman, S. J., Roscoe, E. M., & Bourret, J. C. (2018). Comparing selfdirected methods for training staff to create graphs using Graphpad Prism. Journal of Applied Behavior Analysis,52(1), 188–204. 10.1002/jaba.522 [DOI] [PubMed] [Google Scholar]
- Blair, B. J., & Mahoney, P. J. (2022). Creating single-subject research design graphs with Google Applications. Behavior Analysis in Practice,15(1), 295–311. 10.1007/s40617-021-00604-5 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Carr, J. E., & Burkholder, E. O. (1998). Creating single-subject design graphs with Microsoft Excel™. Journal of Applied Behavior Analysis,31(2), 245–251. 10.1901/jaba.1998.31-245 [Google Scholar]
- Cooper, J.O., Heron, T.E., & Heward, W.L. (2020). Applied Behavior Analysis (3rd ed.). Pearson
- Dixon, M. R., Jackson, J. W., Small, S. L., Horner-King, M. J., Lik, N. M., Garcia, Y., & Rosales, R. (2009). Creating single-subject design graphs in Microsoft Excel™ 2007. Journal of Applied Behavior Analysis,42(2), 277–293. 10.1901/jaba.2009.42-277 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Dotmatics (2024). How to buy prism. https://www.graphpad.com/how-to-buy/
- Dubuque, E. M. (2015). Inserting phase change lines into Microsoft Excel® graphs. Behavior Analysis in Practice,8(2), 207–211. 10.1007/s40617-015-0078-8 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Fuller, T. C., & Dubuque, E. M. (2018). Integrating phase change lines and labels into graphs in Microsoft Excel®. Behavior Analysis in Practice,12(1), 293–299. 10.1007/s40617-018-0248-6 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Gast, D. L., Lloyd, B. P., & Ledford, J. R. (2018). Multiple baseline and multiple probe designs. In J. R. Ledford & D. L. Gast (Eds.), Single case research methodology (pp. 239–281). Routledge. [Google Scholar]
- Gilroy, S. P. (2024). fxl: Faux XL single-case charting package. In Development. 10.5281/zenodo.5758834, https://github.com/miyamot0/fxl
- Gilroy, S. P., Waits, J. A., & Feck, C. (2021). Extending stimulus preference assessment with the operant demand framework. Journal of Applied Behavior Analysis,54, 1032–1044. 10.1002/jaba.826 [DOI] [PubMed] [Google Scholar]
- Ihaka, R., & Gentleman, R. (1996). R: A language for data analysis and graphics. Journal of Computational and Graphical Statistics,5(3), 299–314. 10.1080/10618600.1996.10474713 [Google Scholar]
- Kazdin, A. E. (1982). Single-subject research designs: Methods for clinical and applied settings. Oxford University Pres. [Google Scholar]
- Kratochwill, T. R., Hitchcock, J., Horner, R. H., Levin, J. R., Odom, S. L., Rindskopf, D. M., & Shadish, W.R. (2010). Single-case designs technical documentation. Retrieved from https://ies.ed.gov/ncee/wwc/Docs/ReferenceResources/wwc_scd.pdf. Accessed 20 August 2024.
- Kratochwill, T. R., Hitchcock, J. H., Horner, R. H., Levin, J. R., Odom, S. L., Rindskopf, D. M., & Shadish, W. R. (2012). Single-case intervention research design standards. Remedial and Special Education,34(1), 26–38. 10.1177/0741932512452794 [Google Scholar]
- Kubina, R. M., Kostewicz, D. E., Brennan, K. M., & King, S. A. (2015). A critical review of line graphs in behavior analytic journals. Educational Psychology Review,29(3), 583–598. 10.1007/s10648-015-9339-x [Google Scholar]
- Lanovaz, M. J., & Turgeon, S. (2020). How many tiers do we need? type I errors and power in multiple baseline designs. Perspectives on Behavior Science,43(3), 605–616. 10.1007/s40614-020-00263-x [DOI] [PMC free article] [PubMed] [Google Scholar]
- Martin, G., & Pear, J. (2019). Behavior modification: What it is and how to do it. Routledge. [Google Scholar]
- Microsoft (2024). Compare all microsoft 365 plans (formerly office 365) - microsoft store. https://www.microsoft.com/en-us/microsoft-365/buy/compare-all-microsoft-365-products
- Miltenberger, R. G. (2023). Behavior modification: Principles and procedures. Cengage Learning. [Google Scholar]
- Mitteer, D. R., Greer, B. D., Fisher, W. W., & Cohrs, V. L. (2018). Teaching behavior technicians to create publication-quality, single-subject design graphs in graphpad prism 7. Journal of Applied Behavior Analysis,51(4), 998–1010. 10.1002/jaba.483 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Morley, S., Masterson, C., & Main, C. J. (2018). Single-subject methods in clinical psychology: A practical guide. Routledge. [Google Scholar]
- Paradis, E. (2005). R for Beginners. https://cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf. Accessed 20 Aug 2024
- Pritchard, J. K. (2008). A decade later: Creating single-subject design graphs with Microsoft Excel 2007™. The Behavior Analyst Today,9(3–4), 153–161. 10.1037/h0100655 [Google Scholar]
- R Core Team. (2024). R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/. [Google Scholar]
- Ribes-Iñesta, E., & Ruiz, J. A. (2021). Spatial distribution of behavior under concurrent random-time schedules of water. Behavioural Processes,193, 104549. 10.1016/j.beproc.2021.104549 [DOI] [PubMed] [Google Scholar]
- Ribes-Iñesta, E., Ruiz, J. A., & Castillo, J. (2022). Spatial organization of Rat’s behavior in a situation with three optional lever-pressing responses under continuous and fixed-interval schedules of food. Behavioural Processes,201, 104733. 10.1016/j.beproc.2022.104733 [DOI] [PubMed] [Google Scholar]
- Riley-Tillman, T. C., Burns, M. K., & Kilgus, S. P. (2020). Evaluating educational interventions single-subject design for measuring response to intervention. The Guilford Press. [Google Scholar]
- RStudio Team. (2024). RStudio: Integrated Development Environment for R. PBC, Boston, MA: RStudio. http://www.RStudio.com/. [Google Scholar]
- Ruiz, J. A., Guerrero, C. G., Gutiérrez-Moreno, I. A., & Tamayo, J. (2022). Análisis de dimensiones continuas del comportamiento: Un tutorial en R. Revista Mexicana De Análisis De La Conducta,48(1), 27–51. 10.5514/rmac.v48.i1.82747 [Google Scholar]
- Vanselow, N.R., & Bourret, J.C. (2012). Online Interactive Tutorials for Creating Graphs With Excel 2007 or 2010. Behavior Analysis Practice, 5, 40–46 (2012). 10.1007/BF03391816 [DOI] [PMC free article] [PubMed]
- Wickham, H. (2019). Advanced R. CRC Press. [Google Scholar]
- Wickham, H., & Bryan, J. (2023). readxl: Read Excel Files. R package version 1.4.3. https://CRAN.R-project.org/package=readxl. Accessed 20 Aug 2024
- Wickham, H., Danenberg, P., Csárdi, G., & Eugster, M. (2022). roxygen2: In-Line Documentation for R. R package version 7.2.3. https://CRAN.R-project.org/package=roxygen2. Accessed 20 Aug 2024
- Wickham, H., Hester, J., Chang, W., & Bryan, J. (2022). devtools: Tools to Make Developing R Packages Easier. R package version 2.4.5. https://CRAN.R-project.org/package=devtools. Accessed 20 Aug 2024
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
Data used to illustrate the use of the functions described in this work were generated by computer simulation and can be accessed, as well as their corresponding documentation, by installing the R package RDARBS created by the authors.




