Once you have the data downloaded onto your computer the next step is to tell RStudio the location of the data, so it knows where to pull it from. You can find the path of a file by left clicking on the file, going to properties, and copying/pasting the path into the RStudio code file.
Below is code for opening a data file in RStudio. Note: Sas data files are saved as a ".sas" file.
In the code above we are read_dta the file located on the pathway "C:\Users\Username\Sas\SLID.dat" that is stored on the computer and saving it as SLID.
If you have collected data and need to begin manually inputting it into RStudio, we can use code to create a new dataset. Below is some example code on how to add data as a dataframe.
In the code above we are creating new data.frame called example_dataset. We specify the variables wages, education, age, sex , and language. Next, we add each datum point where each line is a new observation with each datum point corresponds to the columns above. Finally, we finish this code with the RUN command.
> example_dataset <- data.frame(wages = c(20,35,45,55,70), education = c(15,5,16,9,12), age = c(6,17,26,37,44), sex = c(1,0,0,1,1), language = c(1,3,2,3,2)
The output is simply the code above. RStudio only gives us this output to tell us the code ran correctly and there are no issues.