Once imported in R, it is most convenient to save the data as a RDA file (R DAta file). This format stores all the data, including the data type, available for later use or exchange with colleagues (without having to re-import a spreadsheet and define each variable type).
This RDA file contains the heights of 10 people.
To open the data file:
load('/path/to_file/height10.rda')
ls()
[1] "height10"
height10
height
1 184
2 146
3 169
4 185
5 160
6 173
7 179
8 171
9 160
10 150
str(height10)
'data.frame': 10 obs. of 1 variable:
$ height: num 184 146 169 185 160 173 179 171 160 150
The data frame nerve is preserved within the file. To show the data frames that are loaded in the environment, the list function (ls()) can be used.
The variable name and type should already be appropriately set. (but please check with str() before proceeding with analysis).
To save a changed data frame in rda file format:
save(height10, file = '/path/to_file/height10.rda')
(please edit the /path/to_file/ to the appropriate location of the file).
If the file name is the same as the data frame, it would be easier to find it later! But otherwise the ls() function can be used to recall the data frame.