我在 R Studio 服务器上工作,我想将文件上传到服务器。我知道如何通过点击上传按钮来做到这一点。
https://support.rstudio.com/hc/en-us/articles/200713893-Uploading-and-Downloading-Files
1.切换到文件面板
2.导航到您要将文件上传到的目录
3.点击上传工具栏按钮
4.选择您要上传的文件并按OK
有没有办法用代码做到这一点?
我想提取除模式之外的所有内容并将其返回到字符串中。
我试图将 str_extract_all 与 sapply 和 cat 结合在一起
x = c("a_1","a_20","a_40","a_30","a_28")
data <- tibble(age = x)
# extracting just the first pattern is easy
data %>%
mutate(age_new = str_extract(age,"[^a_]"))
# combining str_extract_all and sapply doesnt work
data %>%
mutate(age_new = sapply(str_extract_all(x,"[^a_]"),function(x) cat(x,sep="")))
class(str_extract_all(x,"[^a_]"))
sapply(str_extract_all(x,"[^a_]"),function(x) cat(x,sep=""))
Run Code Online (Sandbox Code Playgroud)
返回 NULL 而不是串联模式