I created a list of lists, each one representing one variable by doing this:
names(needed_data) <- c(
"Ano", "Casamentos Hungria", "Casamentos Eslovénia",
"Casamentos Noruega", "Divórcios Hungria",
"Divórcios Eslovénia","Divórcios Noruega"
)
Then, I proceeded to use needed_data
in a ggplot
function, but when I write, for example aes(x = "Ano", y = "Casamentos Hungria")
, I don't think R-Studio "understands" this code. How should I name the list, so that it works?
CodePudding user response:
aes()
uses tidy evaluation - try either
aes(x = Ano, y = `Casamentos Hungria`)
or
aes_string(x = "Ano", y = "`Casamentos Hungria`")