I am trying to use config.yml in R. But whenever I load the file using
my config file looks like this
default:
dataconnection:
driver: 'ODBC Driver 11 for SQL Server'
server: 'server'
uid: 'Username'
pwd: 'password'
port: 1433
database: 'Data_Science'
rsconnect:
dataconnection:
driver: 'FreeTDS'
server: 'server'
uid: 'username'
pwd: 'password'
port: 1433
database: 'Data_Science'
Code:
config <- config::get(file = "C:/Users/Samuel.Golomeke/Documents/Data Science/Codes/R codes/SQL_Server_shiny_connect/config")
I keep getting the following warning message:
Warning message: In readLines(con) : incomplete final line found on 'C:\Users\Samuel.Golomeke\Documents\Data Science\Codes\R codes\SQL_Server_shiny_connect\config.yaml'"
why is that?
One of the most common uses for YAML is to create configuration files. It's recommended that configuration files be written in YAML rather than JSON, even though they can be used interchangeably in most cases, because YAML has better readability and is more user-friendly.
YAML (“Yet Another Markup Language” or “YAML Ain't Markup Language,” depending on who you ask) is the metadata that tells R Markdown, pandoc, and other software exactly how to process or display the document.
The yml file is simply a text file (use File > New file > Text File in RStudio). Save it as _site. yml or it won't work. You can also create a regular RScript or Rmarkdown file and then choose the pop up menu in the bottom right of the writing pane to change it to YAML.
Make sure the last line in the config.yaml file has a blank line with no whitespace (space, tab, etc).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With