I am trying to create a plot function to create scatter plots. However it cannot seem to work. I believe the df[,y] and df[,x] seems to be the problem but am not sure whats wrong. Please help!
class<-c(1,2,3,4)
level<-c(1,2,3,4)
school<-c(2,3,4,5)
score<-c(5,6,7,8)
performance<-c(3,7,6,5)
dataframe = data.frame(class,level,school,score,performance)
plotScatter <- function(x, y, df) {
plot(df[,y]~df[,x])
}
plotScatter(score, performance, dataframe)