Q:

How do I label my rows and columns in order to work better with them?

I have a dataset with the emisisons of Canada:

and I would like to label the first row to "years" and the second to "emissions".
For example, if I dont do this how can I name my variables in "aes" in ggplot () function:
ggplot(CAN_emissions, aes(___, ___))

A:

To add a name to the first row, we can use rownames(CAN_emissions) <- "emissions" though this won't help much as the years data points are in the column titles, not in a row of their own.
Generally speaking, you'll struggle to plot the data while it is in a 'wide' format like this. A better solution is to convert all of the year columns into rows. The problem of row names will then disappear. We can do this like so:
library(tidyr)
library(dplyr)
library(magrittr)

CAN_emissions <- CAN_emissions %>% 
  pivot_longer(-country, names_to = "year", values_to = "emissions")

The data can then be plotted directly:
ggplot(CAN_emissions, aes(x = year, y = emissions)) + geom_point()

Data:
CAN_emissions <- tibble(
  country = c("Canada"),
  `1800` = 0.00568,
  `1801` = 0.00561,
  `1802` = 0.00555
)

