potfire, TIBCO Software
wdunlap tibco.com
> -Original Message-----
> From: Liviu Andronic [mailto:landronim...@gmail.com]
> Sent: Wednesday, July 11, 2012 2:19 PM
> To: William Dunlap
> Cc: arun; R help
> Subject: Re: [R] fill 0-row data.frame with 1 line of NAs
>
> On
On Wed, Jul 11, 2012 at 9:56 PM, William Dunlap wrote:
> Why does one want to replace a zero-row data.frame
> with a one-row data.frame of NA's? Unless this is for
> an external program that cannot handle zero-row inputs,
> this suggests that there is an unnecessary limitation (i.e.,
> a bug) in
tfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of arun
> Sent: Wednesday, July 11, 2012 10:03 AM
> To: Liviu Andronic
> Cc: R help
> Subject: Re: [R] fill 0-row data.frame
es
#NA NA NA NA NA
A.K.
- Original Message -
From: Liviu Andronic
To: "r-help@r-project.org Help"
Cc:
Sent: Tuesday, July 10, 2012 9:15 AM
Subject: [R] fill 0-row data.frame with 1 line of NAs
Dear all
Is there a simpler method to achie
On Tue, Jul 10, 2012 at 9:15 AM, Liviu Andronic wrote:
> Dear all
> Is there a simpler method to achieve the following: When I obtain an
> empty data.frame after subsetting, I need for it to contain one line
> of NAs. Here's a dummy example:
>> (.xb <- iris[ iris$Species=='zz', ])
> [1] Sepal.Leng
On Jul 10, 2012, at 2:05 PM, Rui Barradas wrote:
Hello,
Em 10-07-2012 18:59, Peter Ehlers escreveu:
On 2012-07-10 08:50, Brian Diggs wrote:
On 7/10/2012 7:53 AM, Peter Ehlers wrote:
On 2012-07-10 06:57, Rui Barradas wrote:
Hello,
If you write a function, it becomes less convoluted...
em
On Tue, Jul 10, 2012 at 4:53 PM, Peter Ehlers wrote:
> Both this and Liviu's original solution destroy the
> factor nature of 'Species' (which may not matter, of
> course). How about
>
>
> (.xb <- iris[ iris$Species=='zz', ])
> .xb <- .xb[1, ] # this probably shouldn't work, but it does.
>
T
Hello,
Em 10-07-2012 18:59, Peter Ehlers escreveu:
On 2012-07-10 08:50, Brian Diggs wrote:
On 7/10/2012 7:53 AM, Peter Ehlers wrote:
On 2012-07-10 06:57, Rui Barradas wrote:
Hello,
If you write a function, it becomes less convoluted...
empty <- function(x){
if(NROW(x) == 0){
On 2012-07-10 08:50, Brian Diggs wrote:
On 7/10/2012 7:53 AM, Peter Ehlers wrote:
On 2012-07-10 06:57, Rui Barradas wrote:
Hello,
If you write a function, it becomes less convoluted...
empty <- function(x){
if(NROW(x) == 0){
y <- rep(NA, NCOL(x))
names(y) <- names(x)
On 7/10/2012 7:53 AM, Peter Ehlers wrote:
On 2012-07-10 06:57, Rui Barradas wrote:
Hello,
If you write a function, it becomes less convoluted...
empty <- function(x){
if(NROW(x) == 0){
y <- rep(NA, NCOL(x))
names(y) <- names(x)
y
}else x
}
(.xb <- iris[ iris$S
On 2012-07-10 06:57, Rui Barradas wrote:
Hello,
If you write a function, it becomes less convoluted...
empty <- function(x){
if(NROW(x) == 0){
y <- rep(NA, NCOL(x))
names(y) <- names(x)
y
}else x
}
(.xb <- iris[ iris$Species=='zz
Hello,
If you write a function, it becomes less convoluted...
empty <- function(x){
if(NROW(x) == 0){
y <- rep(NA, NCOL(x))
names(y) <- names(x)
y
}else x
}
(.xb <- iris[ iris$Species=='zz', ])
empty(.xb)
Hope this helps,
Rui B
Dear all
Is there a simpler method to achieve the following: When I obtain an
empty data.frame after subsetting, I need for it to contain one line
of NAs. Here's a dummy example:
> (.xb <- iris[ iris$Species=='zz', ])
[1] Sepal.Length Sepal.Width Petal.Length Petal.Width Species
<0 rows> (or 0-le
13 matches
Mail list logo