-
Notifications
You must be signed in to change notification settings - Fork 0
/
Module 8
35 lines (31 loc) · 1.08 KB
/
Module 8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
read.table("Assignment 6 Dataset.txt", header=TRUE)
Name.Age.Sex.Grade
1 Raul,25,Male,80
2 Booker,18,Male,83
3 Lauri,21,Female,90
4 Leonie,21,Female,91
5 Sherlyn,22,Female,85
6 Mikaela,20,Female,69
7 Raphael,23,Male,91
8 Aiko,24,Female,97
9 Tiffaney,21,Female,78
10 Corina,23,Female,81
11 Petronila,23,Female,98
12 Alecia,20,Female,87
13 Shemika,23,Female,97
14 Fallon,22,Female,90
15 Deloris,21,Female,67
16 Randee,23,Female,91
17 Eboni,20,Female,84
18 Delfina,19,Female,93
19 Ernestina,19,Female,93
20 Milo,19,Male,67
x=read.table("Assignment 6 Dataset.txt", header=TRUE)
> StudentAverage= ddply(x, "Sex", transform, Grade.Average=mean(Grade))
Error in FUN(X[[i]], ...) : object 'Sex' not found
> StudentMeans <- ddply(x, "Sex", transform, Age.average=mean(Age), Grade.average=mean(Grade))
(ISSUES OCCURED AT THIS SPOT BUT IF FOLLOWING THE COMMANDS, IT SHOULD BE AS FOLLOWS)
write.table(y, "Sorted Averages)
write.table(y,"Sorted_Average",sep=",")
newx = subset(x,grepl("[iI]",x$Name))
write.table(newx,"DataSubset",sep=",")