My goal is to administer both variables and their values in a spreadsheet. Basically I want to be able to add the new values for a new year in a new column and load them into R. I then want to assign the variables named in the first column with the corresponding value in either one of the second or third column.
Input spreadsheet:
Variable | Year2013 | Year2018 |
---|---|---|
age | 12 | 17 |
pets | c(cat,dog,elephant) | c(dog,mouse) |
cars | cars$name | cars$name |
Desired Output: For year 2013
import("dataspreadsheet.csv")
derived from this -->
age <- 12
pets <- c(cat,dog,elephant)
cars <- cars$name
Is there any way to tell R to make this assignment?