To enter data into R, two common and easy to use R functions are utilized.
- The concatenate function, c; and,
- The data.frame function.
The concatenate function, c, is use for combining data points into a single numeric R object. The usage of this function is simply c(), the entries inside the parentheses will be the data points separated by comma. Below is an example of this,
The RData above is a numeric R object with entries of the data points 36, 6, 15, and so on. This R object is then the data, and is ready for some tests.
The data.frame function, on the other hand, is use for entering data into R object in data frame class. This will generate a table when applying fix function to it, which is used as data editor similar to that in Minitab and SPSS.
To do this, assign the variable name of the data first, say R.df. Then run the following
The data frame class above is assigned to R.df variable. Hence, R.df has this frame of data points. But because no data points were entered yet, then fix function is used to open the data editor and enter the data into this R.df data frame.