From: R-help On Behalf Of Jim Lemon
>> Sent: Thursday, September 27, 2018 10:12 AM
>> To: Luigi Marongiu ; r-help mailing list > project.org>
>> Subject: Re: [R] Erase content of dataframe in a single stroke
>>
>> Ah, yes, try 'as.data.frame" on it.
ariables:
$ A: num
$ B: num
$ C: num
Cheers
Petr
-Original Message-
From: R-help On Behalf Of Jim Lemon
Sent: Thursday, September 27, 2018 10:12 AM
To: Luigi Marongiu ; r-help mailing list
project.org>
Subject: Re: [R] Erase content of dataframe in a single stroke
Ah, yes, try &
2 AM
To: Luigi Marongiu ; r-help mailing list
Subject: Re: [R] Erase content of dataframe in a single stroke
Ah, yes, try 'as.data.frame" on it.
Jim
On Thu, Sep 27, 2018 at 6:00 PM Luigi Marongiu
wrote:
Thank you Jim,
this requires the definition of an ad hoc function; strange that R
You're right. Apparently one can form a list with NULL elements but
not a data frame. I just saw Petr's answer, which seems to do the
trick.
Jim
On Thu, Sep 27, 2018 at 6:19 PM Luigi Marongiu wrote:
>
> I am not sure if I got it right; Now I get:
>
> > toNull<-function(x) return(NULL)
> > df<-a
: num
$ B: num
$ C: num
Cheers
Petr
> -Original Message-
> From: R-help On Behalf Of Jim Lemon
> Sent: Thursday, September 27, 2018 10:12 AM
> To: Luigi Marongiu ; r-help mailing list project.org>
> Subject: Re: [R] Erase content of dataframe in a single stroke
&g
Ah, yes, try 'as.data.frame" on it.
Jim
On Thu, Sep 27, 2018 at 6:00 PM Luigi Marongiu wrote:
>
> Thank you Jim,
> this requires the definition of an ad hoc function; strange that R
> does not have a function for this purpose...
> Anyway, it works but it changes the structure of the data. By
> r
Hi Luigi,
Maybe this:
testdf<-data.frame(A=1,B=2,C=3)
> testdf
A B C
1 1 2 3
toNull<-function(x) return(NULL)
testdf<-sapply(testdf,toNull)
Jim
On Thu, Sep 27, 2018 at 5:29 PM Luigi Marongiu wrote:
>
> Dear all,
> I would like to erase the content of a dataframe -- but not the
> dataframe itsel
Dear all,
I would like to erase the content of a dataframe -- but not the
dataframe itself -- in a simple and fast way.
At the moment I do that by re-defining the dataframe itself in this way:
> df <- data.frame(A = numeric(),
+ B = numeric(),
+ C = character())
8 matches
Mail list logo