Second, for a univariate dataset (100 observations, 1 variable), use \n as the delimiter. Basically, put the 100 observations on 100 lines.
Example for football player height:
col1
1.9
2.1
2.0
1.9
1.9
Now to import the data into R. Open R, use the read.csv command, but make sure to use single quotes when giving the filename. Otherwise it will read the data as string.
> data <- read.csv('/path/to/file.csv', header = TRUE)
To check the size of the dataset, use the str() command:
> str(data)
'data.frame': 100 obs. of 1 variable:
$ col1: num -0.1128 -0.4808 -0.0156 -0.2525 0.0834 ...
As you can see, the 'num' that appears after '$ col1:' indicates that the data has been imported as numerical data. Perform a hist() on you data now using the name of the dataset (data) and the variable you wish to test (col1).
Ciao
No comments:
Post a Comment