0
我想複製下面的代碼來模擬一些圖表,我在下載(我猜)時出錯並讀取.csv文件。問題是我不知道如何或在哪裏創建「輸入」目錄,如何在命令行中放置路徑以及是否下載數據。任何人都可以幫忙?謝謝你的時間!讀取CSV文件並創建路徑
library(idbr)
library(countrycode)
library(ggplot2)
library(animation)
library(dplyr)
countries <- c("France", "Switzerland", "Japan", "China", "United States", "Brazil", "Russia", "Morocco")
country.iso2 <- countrycode(countries, "country.name", "fips104")
translation.file <- "input/Population structures past and forecast - Sheet1.csv"
downloadData <- F
years <- 1990:2050
apikey <- "901083ee90dbd111d13f5e270ca00b4abf654be6"
data.file <- paste0("input/", paste(range(years), collapse = "_"), "_",
paste(country.iso2, collapse = "_"), ".csv")
### load translations
txt <- read.csv(translation.file, row.names = 1, stringsAsFactors = F)
Error in file(file, "rt") : no se puede abrir la conexión
Además: Warning message:
In file(file, "rt") :
no fue posible abrir el archivo 'input/Population structures past and forecast - Sheet1.csv': No such file or directory
請正確標記您的問題。看來你正在使用'R',所以補充一點。 –
@ Ansjovis86我的印象是OP沒有在當前工作目錄中創建'input'目錄,這阻止了R創建csv文件。 –