簡體   English   中英

將 zip 文件加載到 R

[英]Load a zip file into R

我收到以下錯誤: Error in file (file, "rt"): cannot open the connection

download.file("http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/ftp/F-F_Research_Data_5_Factors_2x3_CSV.zip", destfile="F-F_Research_Data_5_Factors_2x3_CSV.zip")

unzip("F-F_Research_Data_5_Factors_2x3_CSV.zip")

unzip("F-F_Research_Data_5_Factors_2x3_WIRELESS_CSV.zip")

data <- read.delim("F-F_Research_Data_5_Factors_2x3_Wireless_CSV.TXT", sep = "|")

我能夠讀取數據集:

download(url="http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/ftp/F-F_Research_Data_5_Factors_2x3_daily_CSV.zip", dest="<directory and filename>/F-F_Research_Data_5_Factors_2x3_daily_CSV.zip", mode="wb") 
unzip ("<directory and filename>/F-F_Research_Data_5_Factors_2x3_daily_CSV.zip", exdir = "Yourfilename")

x <- read_csv("<directory and filename>/F-F_Research_Data_5_Factors_2x3_daily.CSV", skip = 3)

x %>%
  mutate_at(vars(-X1), funs(./100))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM