Hi RStudio Community,
I am new to writing functions in R and am not certain if what I am trying to do is possible. I have the below function
convert.todf <- function(y) {
`y` <<- as.data.frame(y)
}
I am trying to make it such that the new output dataframe will have the same name as the argument which I put in. I've tried putting my argument y as y
, (y), "y", and simply as y, but none of those have been working.
Just for a bit of context, the data structure of the arguments I will be using are environments and they are named using numbers (1,2,3). I am planning on using this for multiple arguments theoretically by putting a range of 1:58 as my argument, and hope to get an output of 58 separate data frames using this function.
Any advice/help is appreciated and thank you in advance!