[R] data.dump from S to R: no functions
Agustin Lobo
alobo at ija.csic.es
Thu Feb 21 20:29:27 CET 2002
Janice,
I echo to the rhelp list, it might be
useful for others. My answer is after your message.
On Thu, 21 Feb 2002, Watkins, Janice wrote:
> This isn't a reply that will help you solve your problem but instead a
> request for information. Do you know an easy way to do a data.dump in
> S-Plus that excludes the functions? What I always do is to keep copies of
> the functions in script files, delete the functions, do a data.daump, and
> then reinstall the functions by running the scripts. I use S-Plus version
> 2000 on Windows 98. Thanks in advance for you help, and I hope someone can
> help you solve your problem.
>
> Janice Watkins
>
Very simple. Use objects.summary:
Splus/G:/path-8/meteo/smeteo>a <- objects.summary()
Splus/G:/path-8/meteo/smeteo>a[1:3,]
data.class storage.mode extent object.size
dataset.date
.Last.fixed character character 1 66
99.05.03 10:05
.Last.value character character 15 683 102.02.21
20:0699.04.05 23:54
INM.casa.swb function function 4 2377
99.04.05 23:54
Then select those that are not a function:
Splus/G:/path-8/meteo/smeteo>a <- a[a[,1]!="function",]
Get the names:
Splus/G:/path-8/meteo/smeteo>b <- dimnames(a)[[1]]
Splus/G:/path-8/meteo/smeteo>b
[1] ".Last.fixed" ".Last.value"
"INM.cods" "INMS.clima.pre.cl1"
[5] "INMS.clima.pre.cl12" "INMS.clima.pre.cl4"
etc.
Then if you want you can select in b:
Splus/G:/path-8/meteo/smeteo>b <- b[-c(1,2,32,33,34)]
And finally data.dump:
Splus/G:/path-8/meteo/smeteo>data.dump(b,file="G:/nofunciones.dmb")
You can also write a simple function that would list only
non-function objects (i.e., lsnofun()), usiing the same approach.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list