A type of entering data in R
Sometimes you want to input a datafile in R which does not have header (the names of
the variables) or there is only one variable on a row, etc.
What you can do is use the function scan
For example:
You have a txt datafile called "one' in Desktop. It has the data "19, 3 ,5 ,2 ,6 ,11"
If you use,
scan("C://Users/Desktop/one.txt")
(Recall how the slashes are set up in R)
you will get an error. The reason is that R expects a space as a delimiter between entries.
What you can do is write
scan("C://Users/Desktop/one.txt",sep=",")
sep denotes the separator between entries, in our case the comma.