I have data that is saved to a text file with headers.
grade (X) number of students (Y)
100 7
99 4
98 9
97 14
96 11
95 9
94 15
and so on until
5 2
4 3
3 1
2 1
1 1
I tried loading the data using this code:
> df <- read.table("data.txt",
+ header = TRUE)
It gave me this error:
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
line 1 did not have 7 elements
This is the very first time I use R. Is there a simple way or a code sample to do it?