I have list of name of data.frames with same columns, which I would like to remove. And I intend to iterate them so as not to manually remove those all, as follows:
AllAcctDataNames <- c("MyAcctContinuous1","MyAcctContinuous2","MyAcctDiscrete1",
"MyAcctDiscrete2","MyAcctDates","MyAcctOthers")
#Cleansing and Removing Unnecessary Variables
for (i in AllAcctDataNames) {
get(eval(i))$person_id <- NULL
get(eval(i))$customer_id <- NULL
get(eval(i))$account_id <- NULL
get(eval(i))$person_bkey <- NULL
print(paste0(i," done."))
}
However when I ran them, this error occurs.
Error in get(eval(i))$person_id <- NULL : could not find function "get<-"
I have also tried to use assign as follows:
assign(paste0(i,"$person_id"),NULL)
But it assigns to the variable name MyAcctContinuous1$person_id
instead.
Really appreciate your help on this. Thank you so much!
Regards,
Marlon