How do we tell R that the data is separated by "|" and "/" , if this is not happening in the first row (Column names)?
Responses = read.csv(file="Liveexitsurvey.csv", header =TRUE, check.names=FALSE)
How do we tell R that the data is separated by "|" and "/" , if this is not happening in the first row (Column names)?
Responses = read.csv(file="Liveexitsurvey.csv", header =TRUE, check.names=FALSE)
Remember put a reproducible example of data, is a good way for find excellent help for all community.
Try with this for separator like |
:
Responses <- read.csv('/Users/admin/file.csv', header=TRUE, sep='|' )
Then when I download the file, it won't do it correctly, it won't recognise the columns as being separate, I get 131 observations for 1 single variable when I have around 20 variables.
You need other separator .
try
Responses <- read.csv('/Users/admin/file.csv', header=TRUE, sep=',' )
Basically, the standard functions only allow for one separator (except for white space which can be various characters) and you need to allow for two different separators. Probably going to have to read in as lines of text and then separate into columns more painfully.
How would I do this? Newbie here!
I think it would be rather helpful if you could paste an example of the data in your .csv file into the forum. Then, we could just make up a .csv file our own and provide a solution. It doesn't have to be the real data, just preserve the structure of your raw .csv file (open it in a text editor, copy the structure and provide a desired result, e.g. what columns are actually present in your example and what should be inside them).
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.