简体   繁体   中英

How to import this csv to R

I have no idea how to import this dataset into R. I tried the read.csv function in many different variations by changing the arguments, but all I get is a dataframe with 63 observations of 1 variable. There should be a lot more variables. Please help me

First download the file into L . Then remove the double quotes at the beginning of each line and replace each semicolon possibly preceded with a double quote with a newline. Next replace each occurrence of two double quotes in a row with one double quote. Now read that with read.csv .

u <- "https://www.dropbox.com/sh/273oj4ah8c4wu98/AACuIQDpIEfrqfVvJWu-mTD1a/associativePersonality.csv?dl=1"
L <- readLines(u)
L2 <- gsub('^"', "", L)
L3 <- gsub('"?;', '\n', L2)
L4 <- gsub('""', '"', L3)
d <- read.csv(text = L4, as.is = TRUE, check.names = FALSE)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM