I wrote a quick for loop to make a series of NQQ plots in R. Each plot corresponds to one column of a data frame. I would like to call the header names so that I can name the plots using the columns they correspond to.
par(mfrow=c(1,8))
for (i in 1:8){
qqnorm(data.c[[i]],main=paste("C",data.c[1,i],sep=""))
qqline(data.c[[i]])
}
In its current form, this code calls the first row of data in my dataframe. How can I get it to call the header row?
Thanks in advance for your help.
If I understand your question correctly, use the
colnames()function to get the name of the columns, instead of the first row.