Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R-使用googlesheets包指定目录_R_Google Sheets - Fatal编程技术网

R-使用googlesheets包指定目录

R-使用googlesheets包指定目录,r,google-sheets,R,Google Sheets,我使用googlesheets软件包。电子表格的默认目录是Google Drive的根目录。我想我可以指定目录,就像指定“普通”目录路径一样,但我不知道怎么做 gs_new(title = "MyData") # export to the root gs_new(title = "Something/MyData") # export to the specified directory 我也对这个问题感兴趣。我将尝试以下方法,看看是否有效。如果没有,我可能会尝试在“googlesheets

我使用
googlesheets
软件包。电子表格的默认目录是Google Drive的根目录。我想我可以指定目录,就像指定“普通”目录路径一样,但我不知道怎么做

gs_new(title = "MyData") # export to the root
gs_new(title = "Something/MyData") # export to the specified directory

我也对这个问题感兴趣。我将尝试以下方法,看看是否有效。如果没有,我可能会尝试在“googlesheets”包的顶部使用“googledrive”包,或者替换“googlesheets”包,以在列表文件夹层次结构中创建工作表。通过这种方式,我可以在子文件夹列表中循环,同时在其中创建任何文件,直到所有子文件夹都创建了新文件

这是我的想法。。。等我有时间测试一下,我会告诉你的

for(path in file_paths){
    setwd(path)
    for(file in files){
        gs_new(file)
    }
}

当然,将父文件夹作为字符串,并使用list.files(“string”,full.names=TRUE)。然后,如果您有任何子文件夹(假设它们已经创建),它将返回一个列表,在其中循环。如果只想在一个位置创建一个工作簿,只需设置工作目录即可。同样,我需要用多种方法来测试这一点

我不明白你的问题。您可以完全按照显示的方式指定路径。如果我运行类似于
gs\u new(title=“Something/MyData”)
的代码,将在根目录中创建名为Something/MyData的电子表格。或者我想在某物目录中创建一个名为MyData的电子表格。