Hi, I've got a really basic problem, but I have no idea how to solve it (new to R). Basically, I'm trying to read a CSV file with 2 variables, but RStudio just doesn't want to detect all the variables, so I can't do tables nor graphs or anything and that's super annoying because I don't understand the reason. The code works great for an excel file provided by my prof, but each time I modify this file, without changing its format, just the data in it, it's not working anymore. HELP.
Hello. I am pretty new myself, but I do it as
ncpath <- "/Users/me/..." ncname <- "name_of_file_without_extension" ncfname <- paste(ncpath, ncname, ".nc", sep="") ncin <- nc_open(ncfname) data_var_1 <- ncvar_get(ncin, "name_of_var1") data_var_2 <- ncvar_get(ncin, "name_of_var2")
Are you specifying sep= as Jaime is doing?
He has specified sep="" for a blank space.
You might need to define a tab sep="\t" or a comma sep=",". These are the most likely separators.
Please can you say a bit more what you mean by "it doesn't detect all the variables"? What tool are you using to try to read in the csv? I would recommend using
read_csv from the
This tries to guess the type of each variable column that it reads in, by sampling the first 1,000 rows. It could be that your variables aren't of the right type, for example if one column is supposed to be numeric but there is a glitch in the data then it may be read in as a character variable. If you can post in some of the code you've tried and any error messages then we can help a bit more easily.
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.