Reputation: 395
For example:
Script_1.R:
AC <- 'tester'
Password <- '123456'
Script_2.R:
source('Script_1.R')
dbConnect(user = AC, password = password)
I wanna hide the value shown on R studio but it can be used when I need to connect DB. Moreover, I wanna make Password '123456' to be shown ****** but the value is equal to 123456.
what should I do? Thank you
Upvotes: 1
Views: 651
Reputation: 714
Since you're using RStudio, you can use rstudioapi::askForPassword()
, which launches a popup for you to type your password in.
If you put this straight into your code, the text you type in will not be saved to your environment:
dbConnect(user = AC, password = rstudioapi::askForPassword())
Upvotes: 3