a<-c(1,2,3,4)
b<-c(1,2,3,4)
c<-c(2,3,4,5)
f<-c(5,6,7,8)
p<-c(3,7,6,5)
df = data.frame(a,b,c,f,p)
for (i in c('c','f','p'))
plot(df$a, df$i)
I am trying to use a loop to plot some columns of a df but df$columnName does not appear to select the correct columns.
I have also tried plot(a~i, df) and it does not work also. Please help!
matplot('colnames<-'(t(df[-1]), df$a), type = 'l')