I have a dataframe created from a loop. The loop examines ordinal regression for a couple dozen outcomes for a given exposure.
At the beginning of the loop, a variable called exposure is defined. Example: exposure <- "MyExposure"
At the end of the routine, I want to actually save the resulting data set I've compiled and to have the name of the saved data object be related to the exposure.
I've had issues with making the left hand side of the assignment based on the variable names.
The name of the new dataframe should be
paste0(exposure,"_imputed_ds")
[1] "MyExposure_imputed_ds"
However, when I try to put this on left hand of an assignment, it fails.
paste0(exposure,"_imputed_ds") <- existing.data.frame
Error in paste0(exposure,"_imputed_ds") <- existing.data.frame
could not find function "paste0<-"
What I wanted was a new dataframe named MyExposure_imputed_ds
that contained contents of existing.data.frame