## 3.2 Importing the Spreadsheet into Rstudio

To get our data into R, we need to save our data in a format and at a place where RStudio can open it.

### 3.2.1 Saving the data in the right format

Generelly, finding the right format to import EXCEL can be tricky.

• If you’re using a PC or Mac, it is advised to save your EXCEL sheet as a comma-separated-values (.csv) file. This can be done by clicking on “save as” and then choosing (.csv) as the output format in EXCEL.
• With some PCs, RStudios might not be able to open such files, or the files might be distorted. In this case, you can also try to save the sheet as a normal .xslx EXCEL-file and try if this works.

### 3.2.2 Saving the data in your working directory

To function properly, you have to set a working directory for RStudio first. The working directory is a folder on your computer from which RStudio can use data, and in which output it saved.

1. Therefore, create a folder on your computer and give it a meaningful name (e.g. “My Meta-Analysis”).
3. Set the folder as your working directory. This can be done in RStudio on the bottom-right corner of your screen. Under the tile “Files”, search for the folder on your computer, and open it.
4. Once you’ve opened your folder, the file you just saved there should be in there.
5. Now that you’ve opened the folder, click on the little gear wheel on top of the pane

1. Then click on “Set as working directory

Your file, and the working directory, are now where they should be!

1. To import the data, simply click on the file in the bottom-right pane. Then click on import dataset…
2. An import assistant should now pop up, which is also loading a preview of your data. This can be time-consuming sometimes, so you can skip this step if you want to, and klick straight on “import”

As you can see, the on the top-right pane Environment, your file is now listed as a data set in your RStudio environment.

1. I also want to give my data a shorter name (“madata”). To rename it, i use the following code:
1. Now, let’s have a look at the structure of my data using the str() function
## Classes 'tbl_df', 'tbl' and 'data.frame':    18 obs. of  17 variables:
##  $Author : chr "Call et al." "Cavanagh et al." "DanitzOrsillo" "de Vibe et al." ... ##$ TE                   : num  0.709 0.355 1.791 0.182 0.422 ...
##  $seTE : num 0.261 0.196 0.346 0.118 0.145 ... ##$ RoB                  : chr  "low" "low" "high" "low" ...
##  $Control : chr "WLC" "WLC" "WLC" "no intervention" ... ##$ intervention duration: chr  "short" "short" "short" "short" ...
##  $intervention type : chr "mindfulness" "mindfulness" "ACT" "mindfulness" ... ##$ population           : chr  "undergraduate students" "students" "undergraduate students" "undergraduate students" ...
##  $type of students : chr "psychology" "general" "general" "general" ... ##$ prevention type      : chr  "selective" "universal" "universal" "universal" ...
##  $gender : chr "female" "mixed" "mixed" "mixed" ... ##$ mode of delivery     : chr  "group" "online" "group" "group" ...
##  $ROB streng : chr "high" "low" "high" "low" ... ##$ ROB superstreng      : chr  "high" "high" "high" "low" ...
##  $compensation : chr "none" "none" "voucher/money" "voucher/money" ... ##$ instruments          : chr  "DASS" "PSS" "DASS" "other" ...
##  \$ guidance             : chr  "f2f" "self-guided" "f2f" "f2f" ...

Although this output looks kind of messy, it’s already very informative. It shows the structure of my data. In this case, i used data for which the effect sizes were already calculated. This is why the variables TE and seTE appear. I also see plenty of other variables, which correspond to the subgroups which were coded for this dataset.

Here’s a (shortened) table created for my data

Author TE seTE RoB Control intervention duration intervention type
Call et al. 0.7091362 0.2608202 low WLC short mindfulness
Cavanagh et al. 0.3548641 0.1963624 low WLC short mindfulness
DanitzOrsillo 1.7911700 0.3455692 high WLC short ACT
de Vibe et al. 0.1824552 0.1177874 low no intervention short mindfulness
Frazier et al. 0.4218509 0.1448128 low information only short PCI
Frogeli et al. 0.6300000 0.1960000 low no intervention short ACT
Gallego et al. 0.7248838 0.2246641 high no intervention long mindfulness
Hazlett-Stevens & Oren 0.5286638 0.2104609 low no intervention long mindfulness
Hintz et al. 0.2840000 0.1680000 low information only short PCI
Kang et al. 1.2750682 0.3371997 low no intervention long mindfulness
Kuhlmann et al. 0.1036082 0.1947275 low no intervention short mindfulness
Lever Taylor et al. 0.3883906 0.2307689 low WLC long mindfulness
Phang et al. 0.5407398 0.2443133 low no intervention short mindfulness
Rasanen et al. 0.4261593 0.2579379 low WLC short ACT
Ratanasiripong 0.5153969 0.3512737 high no intervention short mindfulness
Shapiro et al. 1.4797260 0.3152817 low WLC long mindfulness
SongLindquist 0.6125782 0.2266834 high WLC long mindfulness
Warnecke et al. 0.6000000 0.2490000 low information only long mindfulness