I am very new to R and am struggling to import data from a .csv file.
Specifically, I am trying to pull 31 responses, some "1", some "2", some "3", and some "4" from the .csv file. This data is under the header Q21
So I tried doing:
c <- mydata["Q21"] #because (mydata$21) gave an "$ operator is invalid for atomic vectors response
But that just returned [1] NA
I am looking for 31 integer responses.
No idea what I'm doing wrong. Would truly appreciate any and all help as I get on my feet with this language.
EDIT:
str(mydata) yields chr "/Users/charles/Documents/Work/Survey/CSV/Acme_Company.csv"
I did use read.csv(mydata) and it produced everything, it seemed to have column headings like Q20.
When I typed in c <- mydata$Q21 (that was a typo I wrote before), I got: Error in mydata$Q21 : $ operator is invalid for atomic vectors
mydata[1:3,] Error in mydata[1:3, ] : incorrect number of dimensions
is.data.frame(mydata) [1] FALSE
colnames(mydata) NULL
mydata[, "Q21"] Error in mydata[, "Q21"] : incorrect number of dimensions
So I don't know-- mydata isn't a data frame, right? So what should I do if I want to use the information in it?