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文件。 –