Erik Iverson-3 wrote:
>
>
>
> Michael Lachmann wrote:
>>> On 08/01/2010 08:48 PM, thmsfuller...@gmail.com wrote:
Hi,
The following two 'df's should be the same, although their
constructions are different.
>>> But they aren't the same.
>>>
>>> df1 <- data.frame(X=c(1, 2, 3),
Michael Lachmann wrote:
On 08/01/2010 08:48 PM, thmsfuller...@gmail.com wrote:
Hi,
The following two 'df's should be the same, although their
constructions are different.
But they aren't the same.
df1 <- data.frame(X=c(1, 2, 3), Y=c(4, 5, 6))
df2 <- data.frame(X=1:3, Y=4:6)
identical(df1, d
> On 08/01/2010 08:48 PM, thmsfuller...@gmail.com wrote:
>> Hi,
>>
>> The following two 'df's should be the same, although their
>> constructions are different.
>
> But they aren't the same.
>
> df1 <- data.frame(X=c(1, 2, 3), Y=c(4, 5, 6))
> df2 <- data.frame(X=1:3, Y=4:6)
> identical(df1, df2)
At the risk of repeating a post I haven't read, the two constructs are
different because 1:3 returns a vector of integers (class "integer") and
c(1, 2, 3) is a bit more conservative about what '1' and the like mean
and returns a vector of class "numeric".
lapply(df1, class)
lapply(df2, class)
O
t;
>
>
>
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Erik Iverson
> Sent: Monday, 2 August 2010 1:48 PM
> To: thmsfuller...@gmail.com
> Cc: r-help@r-project.org
> Subject: Re: [R] Why do the r
inal Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Erik Iverson
Sent: Monday, 2 August 2010 1:48 PM
To: thmsfuller...@gmail.com
Cc: r-help@r-project.org
Subject: Re: [R] Why do the results of paste() depend on how the argument
(data.frame) is c
On 08/01/2010 08:48 PM, thmsfuller...@gmail.com wrote:
Hi,
The following two 'df's should be the same, although their
constructions are different.
But they aren't the same.
df1 <- data.frame(X=c(1, 2, 3), Y=c(4, 5, 6))
df2 <- data.frame(X=1:3, Y=4:6)
identical(df1, df2)
yields FALSE
See
st
Hi,
The following two 'df's should be the same, although their
constructions are different. But the results of paste() are different.
I don't see this is explained in ?paste. Could you help me understand
why it is like this?
> df=data.frame(X=c(1, 2, 3), Y=c(4, 5, 6))
> df
X Y
1 1 4
2 2 5
3 3 6
8 matches
Mail list logo