Skip to content

data.dump from S to R: no functions

1 message · Agustin Lobo

#
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:

            
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._