I apologize for I am new here, so hello. I am currently in a graduate course and I am feeling discouraged as I have tried numerous times to perfect this code and I am still getting an Error message. Any tips?
Data <- read.csv("/Users/mopopo/Desktop/Econ5370/ps1_q2.csv",header=TRUE)
(Don't use lower case data, because that's the name of a function. Same with df, although you can often get away with it. And it's good practice to put a space before an after operators, such as <- .)
Better yet
install packages("readr")
and
Data <- read_csv("/Users/mopopo/Desktop/Econ5370/ps1_q2.csv")
which does a generally better job of assigning the correct variable type.
An easy way to do this is to use the "Import Dataset" button in Rstudio. It is located in the environment tab (top right panel of Rstudio by default). See the screenshot:
Your colour scheme is likely different, but you should be able to find that button. It will allow you to select the file using a graphical interface, and then will show you the code required for importing in future.
If you still receive an error message about "unexpected input", then double check that your CSV file is as expected - I believe that error may be caused by unexpected characters or symbols or a malformed CSV file.
You could use file.choose() in the console. Appear a new window and select the file. The console show the path or directory of his file. Copy and paste the path.