我喜欢RGoogleDocs并且使用它很多.但是,我不喜欢一直输入密码.显然我可以在R脚本中输入密码,而不必再次输入密码.但这不可行,因为这意味着我的密码将在我的硬盘上保持未加密状态.此外,我与同事分享我的脚本.
为了解决这个问题,我提出了这个问题.
if(exists("ps")){
print("got password, keep going")
} else {
ps <-readline(prompt="get the password in ")
}
options(RCurlOptions = list(
capath = system.file("CurlSSL", "cacert.pem",
package = "RCurl"), ssl.verifypeer = FALSE)
)
sheets.con = getGoogleDocsConnection(
getGoogleAuth("notreal@gmail.com", ps, service ="wise"))
#WARNING: this would prevent curl from detecting a 'man in the middle' attack
ts2=getWorksheets("hpv type",sheets.con)
Run Code Online (Sandbox Code Playgroud)
我喜欢使用RStudio.当我看到办公室里的任何同事显示我的密码时,我感到很不舒服.我使用了假密码,但看看图像.
.此外,如果我保存了一个工作区,我的密码会随之保存,如果几个月之后,当我很久以前忘记了它的内容时,我担心我会把它交给别人,我发送了我的.RData向同事提交.