繁体   English   中英

为什么我的工作目录不是 function - R

[英]Why does my working directory not function - R

我最近开始使用 R,但我的工作目录似乎无法正常工作。 我一直在尝试将 JSON 文档简单地转换为桌面上的文件(以简化操作),但它没有做任何事情。 奇怪的是它也不显示错误消息。

有人可以帮忙吗?

library ("jsonlite")
library ("ggplot2")
library ("stringr")
library ("arules")

setwd("~/Desktop")


tmp <- readLines("https://pomber.github.io/covid19/timeseries.json")
jsonLot <- fromJSON(tmp)

myjsonLot <- toJSON(jsonLot, pretty=TRUE)
print(myjsonLot)
View(myjsonLot)
fileConn <- file(paste0("~/Desktop", "Covid19_timeseries.json"))
writeLines(myjsonlot, fileConn)
close(fileConn)

这份文件大约 17mb。 由于您没有以任何方式操纵它,我宁愿直接下载它而不是尝试将它加载到 memory:做

destination <- "~/Desktop/Covid19_timeseries.json"
download.file('https://pomber.github.io/covid19/timeseries.json', destination)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM