我愛RGoogleDocs並使用它很多。但是,我不喜歡隨時輸入我的密碼。顯然,我可以在R腳本中輸入密碼,而不必再次輸入密碼。但那不是可行的,因爲這意味着我的密碼將在我的硬盤上保持未加密。此外,我與同事分享我的腳本。如何防止在使用RGoogleDocs時暴露我的密碼?
爲了解決這個問題,我想出了這個。
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("[email protected]", ps, service ="wise"))
#WARNING: this would prevent curl from detecting a 'man in the middle' attack
ts2=getWorksheets("hpv type",sheets.con)
我喜歡使用RStudio。我感到不舒服,因爲當時我的辦公室裏的任何同事都在顯示我的密碼。我用了一個假密碼,但看看圖像。 。此外,如果我保存了一個工作區,我的密碼將與它保存在一起,如果幾個月後,當我早已忘記其中的內容時,我就會將它交給其他人,我將我的.RData文件給同事。
我在earlier post裏讀了關於R中密碼的一般信息。在使用RGoogleDocs時,它沒有給我足夠的信息來隱藏我的密碼。
,看到http://stackoverflow.com/a/36218700/3827849 – 2016-04-20 22:50:09