Last chance! 50% off unlimited learning
Sale ends in
Load credentials from a local YML file. You can set your .Renviron
and the LARES_CREDS
parameter to remember (forever) the directory
of your credentials' file. To use it later, you may leave dir = NA
.
You may also use this function for external (non-lares
) code/use.
get_credentials(
from = NA,
dir = NA,
filename = "config.yml",
env = "LARES_CREDS"
)get_creds(from = NA, dir = NA, filename = "config.yml", env = "LARES_CREDS")
Character. Family of values to import from the YML file.
If you don't know these names, set from = NA
and a warning will display all possible values, depending on your YML file.
Character. Credentials directory where your YML file is.
If used frequently, set your directory by using the .Renviron
file.
To do so, leave dir
as NA
and follow the steps.
If dir
is a list, it'll return dir
(manual credentials input).
Character. YML filename with your credentials.
Character. Environment variable name. No need to set differently for any function that uses this library. Only for external use.
List. Result of reading your credential's YML file, filtered by your
from
input if provided.
The first time you use any function that has the creds
parameter, if
the dir
parameter is set to NA
, this function will ask you to
set the directory where you save your YML local file with your credentials.
This will be asked once and will be set for further R sessions. Remember to
reset your session for this setup to start working properly.
A YML file is a text file, with .yml
file format. You may start from
the dummy YML file shared which shows the structure you must follow to set your
credentials file. Check it out
here
or find it locally using system.file("docs", "config.yml", package = "lares")
.
Other Tools:
autoline()
,
bindfiles()
,
bring_api()
,
db_download()
,
db_upload()
,
export_plot()
,
export_results()
,
h2o_predict_API()
,
h2o_predict_MOJO()
,
h2o_predict_binary()
,
h2o_predict_model()
,
h2o_selectmodel()
,
haveInternet()
,
image_metadata()
,
importxlsx()
,
ip_data()
,
json2vector()
,
listfiles()
,
mailSend()
,
msplit()
,
myip()
,
quiet()
,
read.file()
,
statusbar()
,
tic()
,
try_require()
,
updateLares()
,
zerovar()
Other Credentials:
db_download()
,
db_upload()
,
get_tweets()
,
mailSend()
,
queryDB()
,
queryGA()
,
slackSend()
,
stocks_file()
,
stocks_report()
# NOT RUN {
# Load dummy config.yml file from the library
# Recommendation: set dir with NA (read documentation)
# We need the directory, not the file
yml <- dirname(system.file("docs", "config.yml", package = "lares"))
# Let's see which credentials we have in our file
get_credentials(dir = yml)
# Warning message: No credentials for NA found in your YML file.
# Try any of the following: 'service1', 'service2', 'service3'
# Get credentials for service2
get_credentials("service2", dir = yml)
# }
Run the code above in your browser using DataLab