I want to access a table, but the name of the table is stored in a variable.
How do i use this variable to read the table?
Example :
DATA1 <- data.frame(SR = c(1:10), VALUE = seq(1,100,10)) #### has 10 rows
DATA2<- data.frame(SR = c(1:11), VALUE = seq(1,110,10)) #### has 11 rows
DATA3<- data.frame(SR = c(1:12), VALUE = seq(1,120,10)) #### has 12 rows
##### ---- list of data table
DATA_TABLE_LIST <- list(DATA1,DATA2,DATA3)
#### ----- given names to elements of list
names(DATA_TABLE_LIST) <- c("DATA1","DATA2","DATA3" )
#### ---- identify element of list which has minimum rows
TABLE_NAME <- names(DATA_TABLE_LIST)[which( sapply(DATA_TABLE_LIST,nrow) == min(sapply(DATA_TABLE_LIST,nrow)))]
#### ---- 'TABLE_NAME' stores the name of a datatable which has the minimum rows ( in this case it is DATA1)
How do i access the data table with the name stored in 'TABLE_NAME' ?