Reading a .por dataset into R from google drive

可紊 提交于 2020-08-06 05:14:41

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!