dear peter,
Its workingthanks a lot...
yours sincerely,
AKSHAY M KULKARNI
From: Peter Langfelder
Sent: Saturday, July 28, 2018 11:41 AM
To: akshay...@hotmail.com
Cc: r-help
Subject: Re: [R] subsetting ls() as per class...
Looking at ?rm
> objClasses <- unlist(eapply(.GlobalEnv, function(x)class(x)[1]))
> head(objClasses)
f E
"function" "environment"
df h
"tbl_df""function"
myData L
"list""list"
> names(objClasses)[objClasses=="tbl_df"]
The ll() function of R.oo returns a data.frame with various attributes that
you can subset on, e.g.
> subset(R.oo::ll(), data.class %in% c("zoo", "xts"))
member data.class dimension objectSize
2 fzzoo10 1344
4 sample.xtsxts c(180,4) 10128
5
You can extract the names into a character vector with ls and then use
grep(..., values=TRUE ) to select which ones you want to remove, and then pass
that list to rm.
However, due to the way R handles memory you are unlikely to see much savings
by doing this. I would recommend focusing on
Looking at ?rm, my solution would be something like
rm(list = grep("\\.NS$", ls(), value = TRUE))
But test it since I have not tested it.
Peter
On Fri, Jul 27, 2018 at 10:58 PM akshay kulkarni wrote:
>
> dear memebers,
>I am using R in AWS linux instance for
dear memebers,
I am using R in AWS linux instance for my
research. I want to remove certain objects from the global environment to
reduce my EBS cost..for example, I want to remove all objects of class "xts",
"zoo". Is there any way to automate this, instead of
6 matches
Mail list logo