问题
Following this answer, I'm trying to read a .por
file into R via a shareable link (https://drive.google.com/file/d/124WOY4iBXxv_9eBXsoHJVUzX98x2sxYy/view?usp=sharing) without success (using haven
package):
Error in df_parse_por_file(spec, encoding = "", user_na = user_na, cols_skip
Is this fixable?
Tried the following:
library(haven)
id <- '124WOY4iBXxv_9eBXsoHJVUzX98x2sxYy'
j <- sprintf("https://docs.google.com/uc?id=%s&export=download", id)
dta <- haven::read_por(j)
回答1:
You could use googledrive
package to download the file first:
library(googledrive)
googledrive::drive_download('https://drive.google.com/file/d/124WOY4iBXxv_9eBXsoHJVUzX98x2sxYy/view?usp=sharing','test.por',overwrite=T)
dta <- haven::read_por('test.por')
来源:https://stackoverflow.com/questions/63182133/reading-a-por-dataset-into-r-from-google-drive