About this question
I have loaded different objects in R console and I can remove all of them using:
rm(list=ls())removing only functions but not the variables:
rm(list=lsf.str())but How can I remove all varaibles except the functions?
I have loaded different objects in R console and I can remove all of them using:
rm(list=ls())removing only functions but not the variables:
rm(list=lsf.str())but How can I remove all varaibles except the functions?
Log in to share your answer and help other learners.
Log in to answerBest Answer · By JanBask Python Expert
Answered on Jul 10, 2021
To remove all variables in r except for functions , you can use:
If you also want to remove objects whose names start with a period, use this instead: rm(list=setdiff(ls(all.names=TRUE), lsf.str(all.names=TRUE)))
Or use
rm(list = setdiff(ls(), lsf.str()))