Question: What is the error in this code and how can I fix it. This code works for my class mates but won't run properly for

 What is the error in this code and how can Ifix it. This code works for my class mates but won't run

What is the error in this code and how can I fix it. This code works for my class mates but won't run properly for me. Im trying to calculate some Anova calculations in R.

df-data. frame Y=C(11, 13, 9, 16, 22, 23, 19, 13, 21, 13, 14, 15), Field=c("A", "A", "A", "B", "B", "B", "C", "C", "C", "D", "D", "D",) df$M mean(df$Y) df$F = NA for(x in levels factor df$Field)) { df [df$Field=-X,]$F = mean(df [df$Field=-X,]$Y) } df$MY df$MF df$FY dfSM - df$Y df SM df$F df$F - df$Y + : > df=data.frame( + Y=C(11, 13, 9, 16, 22, 23, 19, 13, 21, 13, 14, 15), Field=c("A", "A", "A", "B", "B", "B", "C", "C", "C", "D", "D", "D",) Error in data.frame(Y = C(11, 13, 9, 16, 22, 23, 19, 13, 21, 13, 14, 15), argument is missing, with no default > df$M = mean(df$Y) Error in df$Y : object of type 'closure' is not subsettable > df$F = NA Error in df$F = NA : object of type 'closure' is not subsettable + > forX in levels(factor(df$Field)) { df[df$Field==X,]$F = mean(df[df$Field==X,]SY) + } Error: object of type 'closure' is not subsettable > df$MY = df$M - df$Y Error in df$M : object of type 'closure' is not subsettable > df$MF = df$M - df$F Error in df$M : object of type 'closure' is not subsettable > df$FY = df$F - df$Y Error in df$F : object of type 'closure' is not subsettable

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!