I'm trying to create a dataframe to assist in downstream calculations. All "MineralVars" need an NA value in this 1-row dataframe. MineralVars will always change in length and variable names, so I can't create the dataframe by inputting each Mineral one at a time. I need to create it using the string 'MineralVars'.
# Declare variables
MineralVars <- c("Al", "Cu", "Pb")
# Create helper dataframe
Placeholder_df <- data.frame(make = "Placeholder", modelid = "Placeholder",
unitno = "Placeholder", compart = "Placeholder",
MineralVars = NA, meterread = NA, order = NA)
My desired dataframe would look like this;
Desired_df <- data.frame(sampledate = NA, make = "Placeholder", modelid = "Placeholder",
unitno = "Placeholder", compart = "Placeholder", oilchanged = "Placeholder",
Cu = NA, Pb = NA, Al = NA, meterread = NA, order = NA)