Rearranging the Data For MARSI Analysis

A. Invoking the Required Libraries

library(foreign)
library(dplyr)
library(reshape)
library(WRS)
rm(list = ls())

Reading the Data

D_data <- read.spss("Duplicate_data.sav")

# Changing the data into a data frame
D_data <- as.data.frame(D_data)

# Checking the Dataset
str(D_data)
'data.frame':   13 obs. of  14 variables:
 $ Std_ID        : chr  "Student 1       " "Student 2       " "Student 4       " "Sudent 5        " ...
 $ Gender        : Factor w/ 2 levels "Male","Female": 2 2 1 2 2 2 1 1 2 1 ...
 $ Grade         : Factor w/ 3 levels "Third Grade",..: 1 1 1 1 1 2 2 2 2 3 ...
 $ Teacher       : Factor w/ 4 levels "Luna","Oliver",..: 1 1 1 1 1 2 2 2 2 4 ...
 $ Attendance    : num  16 18 17 14 15 17 15 18 18 14 ...
 $ Wordsread     : num  51858 28575 38867 33160 108885 ...
 $ MARSIGRSPre   : num  2.4 1.8 3.4 3 3.4 1.6 3.4 2.6 1.2 2.2 ...
 $ MARSIGRSPost  : num  3.2 3.4 4 3.2 3.2 2.6 5 3.8 3.4 4 ...
 $ MARSIPSSPre   : num  3 4 2.6 4.4 3.8 3.8 4 2.2 3.4 4.4 ...
 $ MARSIPSSPost  : num  3 5 2.6 3.8 3.8 3 5 4.2 3.6 4.6 ...
 $ MARSISRSPre   : num  2.8 2 3 4 3.6 3.6 4.2 3.4 3.2 3.8 ...
 $ MARSISRSPost  : num  2.8 4.2 3 3.4 4.2 4 5 2.8 3.2 4.2 ...
 $ MARSITotalPre : num  2.73 2.6 3 3.8 3.8 3 3.86 2.73 2.6 3.46 ...
 $ MARSITotalPost: num  3 4.2 3.2 3.46 3.73 3.2 5 3.6 3.4 4.26 ...

Trimming the Data

MARSI2_data <- D_data[-c(4)]
summary(MARSI2_data)
    Std_ID             Gender           Grade     Attendance   
 Length:13          Male  :4   Third Grade :5   Min.   :14.00  
 Class :character   Female:9   Fourth Grade:4   1st Qu.:15.00  
 Mode  :character              Fifth Grade :4   Median :17.00  
                                                Mean   :16.38  
                                                3rd Qu.:18.00  
                                                Max.   :18.00  
   Wordsread       MARSIGRSPre     MARSIGRSPost    MARSIPSSPre   
 Min.   : 16631   Min.   :1.200   Min.   :2.600   Min.   :2.200  
 1st Qu.: 21316   1st Qu.:2.200   1st Qu.:3.200   1st Qu.:3.400  
 Median : 31066   Median :3.000   Median :3.400   Median :4.000  
 Mean   : 37261   Mean   :2.692   Mean   :3.569   Mean   :3.769  
 3rd Qu.: 38867   3rd Qu.:3.400   3rd Qu.:4.000   3rd Qu.:4.400  
 Max.   :108885   Max.   :3.400   Max.   :5.000   Max.   :4.800  
  MARSIPSSPost    MARSISRSPre     MARSISRSPost   MARSITotalPre  
 Min.   :2.600   Min.   :2.000   Min.   :2.800   Min.   :2.600  
 1st Qu.:3.600   1st Qu.:3.200   1st Qu.:3.200   1st Qu.:2.730  
 Median :4.200   Median :3.600   Median :4.200   Median :3.460  
 Mean   :4.046   Mean   :3.662   Mean   :3.831   Mean   :3.387  
 3rd Qu.:4.600   3rd Qu.:4.200   3rd Qu.:4.200   3rd Qu.:3.860  
 Max.   :5.000   Max.   :5.000   Max.   :5.000   Max.   :4.260  
 MARSITotalPost 
 Min.   :3.000  
 1st Qu.:3.400  
 Median :3.730  
 Mean   :3.813  
 3rd Qu.:4.200  
 Max.   :5.000  

Got rid of teacher variable

Splitting the Dataset into Three Different Datasets

# Pretest Only Dataset
Pretest_Data <- dplyr::select(MARSI2_data, Std_ID, MARSIGRSPre, MARSIPSSPre, MARSISRSPre, MARSITotalPre)

#Posttest Only Dataset
Posttest_Data <- dplyr::select(MARSI2_data, Std_ID, MARSIGRSPost, MARSIPSSPost, MARSISRSPost, MARSITotalPost)

# Demographic Information Only Dataset
Demo_Data <- dplyr::select(MARSI2_data, Std_ID, Gender, Grade, Attendance, Wordsread)

# Checking the New Datasets
Pretest_Data
             Std_ID MARSIGRSPre MARSIPSSPre MARSISRSPre MARSITotalPre
1  Student 1                2.4         3.0         2.8          2.73
2  Student 2                1.8         4.0         2.0          2.60
3  Student 4                3.4         2.6         3.0          3.00
4  Sudent 5                 3.0         4.4         4.0          3.80
5  Student 6                3.4         3.8         3.6          3.80
6  Student 7                1.6         3.8         3.6          3.00
7  Student 9                3.4         4.0         4.2          3.86
8  Student 10               2.6         2.2         3.4          2.73
9  Student 11               1.2         3.4         3.2          2.60
10 Student 13               2.2         4.4         3.8          3.46
11 Student 14               3.2         4.6         4.4          4.06
12 Student 15               3.4         4.8         4.6          4.26
13 Student 17               3.4         4.0         5.0          4.13
Posttest_Data
             Std_ID MARSIGRSPost MARSIPSSPost MARSISRSPost MARSITotalPost
1  Student 1                 3.2          3.0          2.8           3.00
2  Student 2                 3.4          5.0          4.2           4.20
3  Student 4                 4.0          2.6          3.0           3.20
4  Sudent 5                  3.2          3.8          3.4           3.46
5  Student 6                 3.2          3.8          4.2           3.73
6  Student 7                 2.6          3.0          4.0           3.20
7  Student 9                 5.0          5.0          5.0           5.00
8  Student 10                3.8          4.2          2.8           3.60
9  Student 11                3.4          3.6          3.2           3.40
10 Student 13                4.0          4.6          4.2           4.26
11 Student 14                4.2          4.6          4.6           4.46
12 Student 15                3.4          4.8          4.2           4.13
13 Student 17                3.0          4.6          4.2           3.93
Demo_Data
             Std_ID Gender        Grade Attendance Wordsread
1  Student 1        Female  Third Grade         16     51858
2  Student 2        Female  Third Grade         18     28575
3  Student 4          Male  Third Grade         17     38867
4  Sudent 5         Female  Third Grade         14     33160
5  Student 6        Female  Third Grade         15    108885
6  Student 7        Female Fourth Grade         17     16631
7  Student 9          Male Fourth Grade         15     19578
8  Student 10         Male Fourth Grade         18     21316
9  Student 11       Female Fourth Grade         18     19662
10 Student 13         Male  Fifth Grade         14     30453
11 Student 14       Female  Fifth Grade         17     31066
12 Student 15       Female  Fifth Grade         16     48149
13 Student 17       Female  Fifth Grade         18     36191

A. Reshaping the Pretest Data

a. Melting the 4-different Columns in a ‘variable’ and ‘value’ (default) Columns

Pretest_Data1 <- melt(Pretest_Data, id = "Std_ID", measured = c("MARSIGRSPre", "MARSIPSSPre", "MARSISRSPre", "MARSITotalPre"))

#Checking 
Pretest_Data1
             Std_ID      variable value
1  Student 1          MARSIGRSPre  2.40
2  Student 2          MARSIGRSPre  1.80
3  Student 4          MARSIGRSPre  3.40
4  Sudent 5           MARSIGRSPre  3.00
5  Student 6          MARSIGRSPre  3.40
6  Student 7          MARSIGRSPre  1.60
7  Student 9          MARSIGRSPre  3.40
8  Student 10         MARSIGRSPre  2.60
9  Student 11         MARSIGRSPre  1.20
10 Student 13         MARSIGRSPre  2.20
11 Student 14         MARSIGRSPre  3.20
12 Student 15         MARSIGRSPre  3.40
13 Student 17         MARSIGRSPre  3.40
14 Student 1          MARSIPSSPre  3.00
15 Student 2          MARSIPSSPre  4.00
16 Student 4          MARSIPSSPre  2.60
17 Sudent 5           MARSIPSSPre  4.40
18 Student 6          MARSIPSSPre  3.80
19 Student 7          MARSIPSSPre  3.80
20 Student 9          MARSIPSSPre  4.00
21 Student 10         MARSIPSSPre  2.20
22 Student 11         MARSIPSSPre  3.40
23 Student 13         MARSIPSSPre  4.40
24 Student 14         MARSIPSSPre  4.60
25 Student 15         MARSIPSSPre  4.80
26 Student 17         MARSIPSSPre  4.00
27 Student 1          MARSISRSPre  2.80
28 Student 2          MARSISRSPre  2.00
29 Student 4          MARSISRSPre  3.00
30 Sudent 5           MARSISRSPre  4.00
31 Student 6          MARSISRSPre  3.60
32 Student 7          MARSISRSPre  3.60
33 Student 9          MARSISRSPre  4.20
34 Student 10         MARSISRSPre  3.40
35 Student 11         MARSISRSPre  3.20
36 Student 13         MARSISRSPre  3.80
37 Student 14         MARSISRSPre  4.40
38 Student 15         MARSISRSPre  4.60
39 Student 17         MARSISRSPre  5.00
40 Student 1        MARSITotalPre  2.73
41 Student 2        MARSITotalPre  2.60
42 Student 4        MARSITotalPre  3.00
43 Sudent 5         MARSITotalPre  3.80
44 Student 6        MARSITotalPre  3.80
45 Student 7        MARSITotalPre  3.00
46 Student 9        MARSITotalPre  3.86
47 Student 10       MARSITotalPre  2.73
48 Student 11       MARSITotalPre  2.60
49 Student 13       MARSITotalPre  3.46
50 Student 14       MARSITotalPre  4.06
51 Student 15       MARSITotalPre  4.26
52 Student 17       MARSITotalPre  4.13

b. Changing the Column Names to More Descriptive Ones

colnames(Pretest_Data1)<- c("Std_ID", "Measures", "Pretest_Scores")
head(Pretest_Data1)
            Std_ID    Measures Pretest_Scores
1 Student 1        MARSIGRSPre            2.4
2 Student 2        MARSIGRSPre            1.8
3 Student 4        MARSIGRSPre            3.4
4 Sudent 5         MARSIGRSPre            3.0
5 Student 6        MARSIGRSPre            3.4
6 Student 7        MARSIGRSPre            1.6

c. Changing the Labels of Measure to MARSIGRS and so on

Pretest_Data1$Measures <- factor(Pretest_Data1$Measures, labels = c("MARSIGRS", "MARSIPSS", "MARSISRS", "MARSITotal"))
str(Pretest_Data1)
'data.frame':   52 obs. of  3 variables:
 $ Std_ID        : chr  "Student 1       " "Student 2       " "Student 4       " "Sudent 5        " ...
 $ Measures      : Factor w/ 4 levels "MARSIGRS","MARSIPSS",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ Pretest_Scores: num  2.4 1.8 3.4 3 3.4 1.6 3.4 2.6 1.2 2.2 ...
# Putting the Data in Order by Std_ID
Pretest_Data1 <- Pretest_Data1[order(Pretest_Data1$Std_ID),]
Pretest_Data1
             Std_ID   Measures Pretest_Scores
1  Student 1          MARSIGRS           2.40
14 Student 1          MARSIPSS           3.00
27 Student 1          MARSISRS           2.80
40 Student 1        MARSITotal           2.73
8  Student 10         MARSIGRS           2.60
21 Student 10         MARSIPSS           2.20
34 Student 10         MARSISRS           3.40
47 Student 10       MARSITotal           2.73
9  Student 11         MARSIGRS           1.20
22 Student 11         MARSIPSS           3.40
35 Student 11         MARSISRS           3.20
48 Student 11       MARSITotal           2.60
10 Student 13         MARSIGRS           2.20
23 Student 13         MARSIPSS           4.40
36 Student 13         MARSISRS           3.80
49 Student 13       MARSITotal           3.46
11 Student 14         MARSIGRS           3.20
24 Student 14         MARSIPSS           4.60
37 Student 14         MARSISRS           4.40
50 Student 14       MARSITotal           4.06
12 Student 15         MARSIGRS           3.40
25 Student 15         MARSIPSS           4.80
38 Student 15         MARSISRS           4.60
51 Student 15       MARSITotal           4.26
13 Student 17         MARSIGRS           3.40
26 Student 17         MARSIPSS           4.00
39 Student 17         MARSISRS           5.00
52 Student 17       MARSITotal           4.13
2  Student 2          MARSIGRS           1.80
15 Student 2          MARSIPSS           4.00
28 Student 2          MARSISRS           2.00
41 Student 2        MARSITotal           2.60
3  Student 4          MARSIGRS           3.40
16 Student 4          MARSIPSS           2.60
29 Student 4          MARSISRS           3.00
42 Student 4        MARSITotal           3.00
5  Student 6          MARSIGRS           3.40
18 Student 6          MARSIPSS           3.80
31 Student 6          MARSISRS           3.60
44 Student 6        MARSITotal           3.80
6  Student 7          MARSIGRS           1.60
19 Student 7          MARSIPSS           3.80
32 Student 7          MARSISRS           3.60
45 Student 7        MARSITotal           3.00
7  Student 9          MARSIGRS           3.40
20 Student 9          MARSIPSS           4.00
33 Student 9          MARSISRS           4.20
46 Student 9        MARSITotal           3.86
4  Sudent 5           MARSIGRS           3.00
17 Sudent 5           MARSIPSS           4.40
30 Sudent 5           MARSISRS           4.00
43 Sudent 5         MARSITotal           3.80

B. Reshaping the Posttest Data

Postest_Data1 <- melt(Posttest_Data, id = "Std_ID", measured = c("MARSIGRSPost", "MARSIPSSPost", "MARSISRSPost", "MARSITotalPos"))

#Checking 
Postest_Data1
             Std_ID       variable value
1  Student 1          MARSIGRSPost  3.20
2  Student 2          MARSIGRSPost  3.40
3  Student 4          MARSIGRSPost  4.00
4  Sudent 5           MARSIGRSPost  3.20
5  Student 6          MARSIGRSPost  3.20
6  Student 7          MARSIGRSPost  2.60
7  Student 9          MARSIGRSPost  5.00
8  Student 10         MARSIGRSPost  3.80
9  Student 11         MARSIGRSPost  3.40
10 Student 13         MARSIGRSPost  4.00
11 Student 14         MARSIGRSPost  4.20
12 Student 15         MARSIGRSPost  3.40
13 Student 17         MARSIGRSPost  3.00
14 Student 1          MARSIPSSPost  3.00
15 Student 2          MARSIPSSPost  5.00
16 Student 4          MARSIPSSPost  2.60
17 Sudent 5           MARSIPSSPost  3.80
18 Student 6          MARSIPSSPost  3.80
19 Student 7          MARSIPSSPost  3.00
20 Student 9          MARSIPSSPost  5.00
21 Student 10         MARSIPSSPost  4.20
22 Student 11         MARSIPSSPost  3.60
23 Student 13         MARSIPSSPost  4.60
24 Student 14         MARSIPSSPost  4.60
25 Student 15         MARSIPSSPost  4.80
26 Student 17         MARSIPSSPost  4.60
27 Student 1          MARSISRSPost  2.80
28 Student 2          MARSISRSPost  4.20
29 Student 4          MARSISRSPost  3.00
30 Sudent 5           MARSISRSPost  3.40
31 Student 6          MARSISRSPost  4.20
32 Student 7          MARSISRSPost  4.00
33 Student 9          MARSISRSPost  5.00
34 Student 10         MARSISRSPost  2.80
35 Student 11         MARSISRSPost  3.20
36 Student 13         MARSISRSPost  4.20
37 Student 14         MARSISRSPost  4.60
38 Student 15         MARSISRSPost  4.20
39 Student 17         MARSISRSPost  4.20
40 Student 1        MARSITotalPost  3.00
41 Student 2        MARSITotalPost  4.20
42 Student 4        MARSITotalPost  3.20
43 Sudent 5         MARSITotalPost  3.46
44 Student 6        MARSITotalPost  3.73
45 Student 7        MARSITotalPost  3.20
46 Student 9        MARSITotalPost  5.00
47 Student 10       MARSITotalPost  3.60
48 Student 11       MARSITotalPost  3.40
49 Student 13       MARSITotalPost  4.26
50 Student 14       MARSITotalPost  4.46
51 Student 15       MARSITotalPost  4.13
52 Student 17       MARSITotalPost  3.93
#Chaning the Column Names
colnames(Postest_Data1)<- c("Std_ID", "Measures", "Posttest_Scores")
head(Postest_Data1)
            Std_ID     Measures Posttest_Scores
1 Student 1        MARSIGRSPost             3.2
2 Student 2        MARSIGRSPost             3.4
3 Student 4        MARSIGRSPost             4.0
4 Sudent 5         MARSIGRSPost             3.2
5 Student 6        MARSIGRSPost             3.2
6 Student 7        MARSIGRSPost             2.6
#Changing the Measures to Match the Pretest Data
Postest_Data1$Measures <- factor(Postest_Data1$Measures, labels = c("MARSIGRS", "MARSIPSS", "MARSISRS", "MARSITotal"))
str(Postest_Data1)
'data.frame':   52 obs. of  3 variables:
 $ Std_ID         : chr  "Student 1       " "Student 2       " "Student 4       " "Sudent 5        " ...
 $ Measures       : Factor w/ 4 levels "MARSIGRS","MARSIPSS",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ Posttest_Scores: num  3.2 3.4 4 3.2 3.2 2.6 5 3.8 3.4 4 ...
# Putting the Data in Order by Std_ID
Postest_Data1 <- Postest_Data1[order(Postest_Data1$Std_ID),]
Postest_Data1
             Std_ID   Measures Posttest_Scores
1  Student 1          MARSIGRS            3.20
14 Student 1          MARSIPSS            3.00
27 Student 1          MARSISRS            2.80
40 Student 1        MARSITotal            3.00
8  Student 10         MARSIGRS            3.80
21 Student 10         MARSIPSS            4.20
34 Student 10         MARSISRS            2.80
47 Student 10       MARSITotal            3.60
9  Student 11         MARSIGRS            3.40
22 Student 11         MARSIPSS            3.60
35 Student 11         MARSISRS            3.20
48 Student 11       MARSITotal            3.40
10 Student 13         MARSIGRS            4.00
23 Student 13         MARSIPSS            4.60
36 Student 13         MARSISRS            4.20
49 Student 13       MARSITotal            4.26
11 Student 14         MARSIGRS            4.20
24 Student 14         MARSIPSS            4.60
37 Student 14         MARSISRS            4.60
50 Student 14       MARSITotal            4.46
12 Student 15         MARSIGRS            3.40
25 Student 15         MARSIPSS            4.80
38 Student 15         MARSISRS            4.20
51 Student 15       MARSITotal            4.13
13 Student 17         MARSIGRS            3.00
26 Student 17         MARSIPSS            4.60
39 Student 17         MARSISRS            4.20
52 Student 17       MARSITotal            3.93
2  Student 2          MARSIGRS            3.40
15 Student 2          MARSIPSS            5.00
28 Student 2          MARSISRS            4.20
41 Student 2        MARSITotal            4.20
3  Student 4          MARSIGRS            4.00
16 Student 4          MARSIPSS            2.60
29 Student 4          MARSISRS            3.00
42 Student 4        MARSITotal            3.20
5  Student 6          MARSIGRS            3.20
18 Student 6          MARSIPSS            3.80
31 Student 6          MARSISRS            4.20
44 Student 6        MARSITotal            3.73
6  Student 7          MARSIGRS            2.60
19 Student 7          MARSIPSS            3.00
32 Student 7          MARSISRS            4.00
45 Student 7        MARSITotal            3.20
7  Student 9          MARSIGRS            5.00
20 Student 9          MARSIPSS            5.00
33 Student 9          MARSISRS            5.00
46 Student 9        MARSITotal            5.00
4  Sudent 5           MARSIGRS            3.20
17 Sudent 5           MARSIPSS            3.80
30 Sudent 5           MARSISRS            3.40
43 Sudent 5         MARSITotal            3.46

Merging the Data

A. Merging Prestest and Posttest Data by ID and Measures

pre_post <- merge(Pretest_Data1, Postest_Data1, by = c("Std_ID", "Measures"))
pre_post
             Std_ID   Measures Pretest_Scores Posttest_Scores
1  Student 1          MARSIGRS           2.40            3.20
2  Student 1          MARSIPSS           3.00            3.00
3  Student 1          MARSISRS           2.80            2.80
4  Student 1        MARSITotal           2.73            3.00
5  Student 10         MARSIGRS           2.60            3.80
6  Student 10         MARSIPSS           2.20            4.20
7  Student 10         MARSISRS           3.40            2.80
8  Student 10       MARSITotal           2.73            3.60
9  Student 11         MARSIGRS           1.20            3.40
10 Student 11         MARSIPSS           3.40            3.60
11 Student 11         MARSISRS           3.20            3.20
12 Student 11       MARSITotal           2.60            3.40
13 Student 13         MARSIGRS           2.20            4.00
14 Student 13         MARSIPSS           4.40            4.60
15 Student 13         MARSISRS           3.80            4.20
16 Student 13       MARSITotal           3.46            4.26
17 Student 14         MARSIGRS           3.20            4.20
18 Student 14         MARSIPSS           4.60            4.60
19 Student 14         MARSISRS           4.40            4.60
20 Student 14       MARSITotal           4.06            4.46
21 Student 15         MARSIGRS           3.40            3.40
22 Student 15         MARSIPSS           4.80            4.80
23 Student 15         MARSISRS           4.60            4.20
24 Student 15       MARSITotal           4.26            4.13
25 Student 17         MARSIGRS           3.40            3.00
26 Student 17         MARSIPSS           4.00            4.60
27 Student 17         MARSISRS           5.00            4.20
28 Student 17       MARSITotal           4.13            3.93
29 Student 2          MARSIGRS           1.80            3.40
30 Student 2          MARSIPSS           4.00            5.00
31 Student 2          MARSISRS           2.00            4.20
32 Student 2        MARSITotal           2.60            4.20
33 Student 4          MARSIGRS           3.40            4.00
34 Student 4          MARSIPSS           2.60            2.60
35 Student 4          MARSISRS           3.00            3.00
36 Student 4        MARSITotal           3.00            3.20
37 Student 6          MARSIGRS           3.40            3.20
38 Student 6          MARSIPSS           3.80            3.80
39 Student 6          MARSISRS           3.60            4.20
40 Student 6        MARSITotal           3.80            3.73
41 Student 7          MARSIGRS           1.60            2.60
42 Student 7          MARSIPSS           3.80            3.00
43 Student 7          MARSISRS           3.60            4.00
44 Student 7        MARSITotal           3.00            3.20
45 Student 9          MARSIGRS           3.40            5.00
46 Student 9          MARSIPSS           4.00            5.00
47 Student 9          MARSISRS           4.20            5.00
48 Student 9        MARSITotal           3.86            5.00
49 Sudent 5           MARSIGRS           3.00            3.20
50 Sudent 5           MARSIPSS           4.40            3.80
51 Sudent 5           MARSISRS           4.00            3.40
52 Sudent 5         MARSITotal           3.80            3.46

B. Merging the Demo_Data to pre_post Data

long_MARSI <- merge(Demo_Data, pre_post, by = "Std_ID")

# Changing the Variables Types
long_MARSI$Std_ID <- as.factor(long_MARSI$Std_ID)
long_MARSI$Gender <- as.factor(long_MARSI$Gender)
long_MARSI$Grade <- as.factor(long_MARSI$Grade)
long_MARSI$Measures <- as.factor(long_MARSI$Measures)

# Checking
str(long_MARSI)
'data.frame':   52 obs. of  8 variables:
 $ Std_ID         : Factor w/ 13 levels "Student 1       ",..: 1 1 1 1 2 2 2 2 3 3 ...
 $ Gender         : Factor w/ 2 levels "Male","Female": 2 2 2 2 1 1 1 1 2 2 ...
 $ Grade          : Factor w/ 3 levels "Third Grade",..: 1 1 1 1 2 2 2 2 2 2 ...
 $ Attendance     : num  16 16 16 16 18 18 18 18 18 18 ...
 $ Wordsread      : num  51858 51858 51858 51858 21316 ...
 $ Measures       : Factor w/ 4 levels "MARSIGRS","MARSIPSS",..: 1 2 3 4 1 2 3 4 1 2 ...
 $ Pretest_Scores : num  2.4 3 2.8 2.73 2.6 2.2 3.4 2.73 1.2 3.4 ...
 $ Posttest_Scores: num  3.2 3 2.8 3 3.8 4.2 2.8 3.6 3.4 3.6 ...
summary(long_MARSI)
              Std_ID      Gender            Grade      Attendance   
 Student 1       : 4   Male  :16   Third Grade :20   Min.   :14.00  
 Student 10      : 4   Female:36   Fourth Grade:16   1st Qu.:15.00  
 Student 11      : 4               Fifth Grade :16   Median :17.00  
 Student 13      : 4                                 Mean   :16.38  
 Student 14      : 4                                 3rd Qu.:18.00  
 Student 15      : 4                                 Max.   :18.00  
 (Other)         :28                                                
   Wordsread            Measures  Pretest_Scores  Posttest_Scores
 Min.   : 16631   MARSIGRS  :13   Min.   :1.200   Min.   :2.600  
 1st Qu.: 21316   MARSIPSS  :13   1st Qu.:2.783   1st Qu.:3.200  
 Median : 31066   MARSISRS  :13   Median :3.400   Median :3.800  
 Mean   : 37261   MARSITotal:13   Mean   :3.377   Mean   :3.815  
 3rd Qu.: 38867                   3rd Qu.:4.000   3rd Qu.:4.200  
 Max.   :108885                   Max.   :5.000   Max.   :5.000  
                                                                 
head(long_MARSI)
            Std_ID Gender        Grade Attendance Wordsread   Measures
1 Student 1        Female  Third Grade         16     51858   MARSIGRS
2 Student 1        Female  Third Grade         16     51858   MARSIPSS
3 Student 1        Female  Third Grade         16     51858   MARSISRS
4 Student 1        Female  Third Grade         16     51858 MARSITotal
5 Student 10         Male Fourth Grade         18     21316   MARSIGRS
6 Student 10         Male Fourth Grade         18     21316   MARSIPSS
  Pretest_Scores Posttest_Scores
1           2.40             3.2
2           3.00             3.0
3           2.80             2.8
4           2.73             3.0
5           2.60             3.8
6           2.20             4.2

C. Writing the Data into the Local Disc (Working Directory for Futher Analysis)

write.csv(long_MARSI, file = "long_MARSI.csv", row.names = FALSE)

Thank You