I'm having a hard time remembering when I need to enclose things in quotes and when not to.
The easiest to remember is if there's a space between words but beyond that, I can't figure it out.
For example,
quotes are not used with: library(package_name) or head(variable_name),
but they are required with: install.packages("package_name"), ls(“package:package_name”), or read_csv(readr_example(“mtcars.csv”)).
Any ideas on how to help remember when to use them and when not to?
Thanks!
If you do not use quotes, R assumes you are refering to the name of an object, if you use quotes, it assumes you are simply entering a character string value.
#This defines an object
object_name <- 2
# This is the name of an object
object_name
#> [1] 2
# This is a character string
"object_name"
#> [1] "object_name"