rch 2009 10:14 AM
To: Stavros Macrakis
Cc: r-help@r-project.org; Ben Bolker
Subject: Re: [R] Sorting problem
That's leading to another question: How does rank() work?
If I have a character vector
a<- c("2a", "2c", "3", "5" , "2b" ,"4a
That's leading to another question: How does rank() work?
If I have a character vector
a<- c("2a", "2c", "3", "5" , "2b" ,"4a", "4b")
Then a[order(a)] returns
"2a" "2b" "2c" "3" "4a" "4b" "5", which makes sense
But a[rank(a)] returns
"2a" "3" "5" "4b" "2c" "2b" "4a", which does not seem to m
On Sun, Mar 29, 2009 at 5:21 PM, Ben Bolker wrote:
> Adding
>
> xtfrm.numeric <- function(x) {x}
>
> would seem to add the case that people are looking for -- unless
> there's something special that needs to be handled with NAs ???
Yes, that was what I was suggesting. xtfrm currently converts N
Duncan Murdoch-2 wrote:
>
> On 29/03/2009 2:14 PM, Stavros Macrakis wrote:
>> On Sun, Mar 29, 2009 at 6:15 AM, Duncan Murdoch
>> wrote:
>>> On 28/03/2009 4:57 PM, Stavros Macrakis wrote:
On Sat, Mar 28, 2009 at 7:53 AM, Duncan Murdoch
wrote:
1) Where does the name 'xtfrm' come
On 29/03/2009 2:14 PM, Stavros Macrakis wrote:
On Sun, Mar 29, 2009 at 6:15 AM, Duncan Murdoch wrote:
On 28/03/2009 4:57 PM, Stavros Macrakis wrote:
On Sat, Mar 28, 2009 at 7:53 AM, Duncan Murdoch
wrote:
1) Where does the name 'xtfrm' come from?
I don't know.
Hmm. If the origins of the na
On Sun, Mar 29, 2009 at 6:15 AM, Duncan Murdoch wrote:
> On 28/03/2009 4:57 PM, Stavros Macrakis wrote:
>> On Sat, Mar 28, 2009 at 7:53 AM, Duncan Murdoch
>> wrote:
>> 1) Where does the name 'xtfrm' come from?
> I don't know.
Hmm. If the origins of the name are lost in the mists of history,
per
On 28/03/2009 4:57 PM, Stavros Macrakis wrote:
On Sat, Mar 28, 2009 at 7:53 AM, Duncan Murdoch wrote:
...More generally, the xtfrm() function converts a vector into a numeric one
that sorts in the same order. ...
Thanks, I learn a lot just by reading the answers to other people's
questions o
Stavros Macrakis wrote:
> On Sat, Mar 28, 2009 at 7:53 AM, Duncan Murdoch wrote:
>
>> ...More generally, the xtfrm() function converts a vector into a numeric one
>> that sorts in the same order. ...
>>
>
> Thanks, I learn a lot just by reading the answers to other people's
> questions on
On Sat, Mar 28, 2009 at 7:53 AM, Duncan Murdoch wrote:
> ...More generally, the xtfrm() function converts a vector into a numeric one
> that sorts in the same order. ...
Thanks, I learn a lot just by reading the answers to other people's
questions on this list.
Some followup questions:
1) Wher
oject.org [r-help-boun...@r-project.org] On
> Behalf Of Jun Shen [jun.shen...@gmail.com]
> Sent: 28 March 2009 08:26
> To: r-h...@stat.math.ethz.ch
> Subject: [R] Sorting problem
>
> Hi, everyone,
>
> I was trying to sort a data frame by two columns, one increasing, the other
>
] Sorting problem
Hi, everyone,
I was trying to sort a data frame by two columns, one increasing, the other
decreasing and got an error.
"Error in FUN(left) : invalid argument to unary operator",
The command is "BA[order(BA[1],-BA[2]),]". BA is the data frame. It was
working if
2009 08:26
To: r-h...@stat.math.ethz.ch
Subject: [R] Sorting problem
Hi, everyone,
I was trying to sort a data frame by two columns, one increasing, the other
decreasing and got an error.
"Error in FUN(left) : invalid argument to unary operator",
The command is "BA[order(BA[1]
Hi, everyone,
I was trying to sort a data frame by two columns, one increasing, the other
decreasing and got an error.
"Error in FUN(left) : invalid argument to unary operator",
The command is "BA[order(BA[1],-BA[2]),]". BA is the data frame. It was
working if I used increasing on both columns.
Sorry for the last post. I didn't use the latest version of R. It
works under Linux as well for R-2.8.0 patch.
Best
On Thu, Dec 11, 2008 at 11:34 PM, ronggui <[EMAIL PROTECTED]> wrote:
> Sys.setlocale(,"C")
> x1 <- as.character(date()) # I use date to record the time, and save
> it to sqlite data
Sys.setlocale(,"C")
x1 <- as.character(date()) # I use date to record the time, and save
it to sqlite database, to it converted to character
x1_2 <- strptime(x1, "%a %b %d %H:%M:%S %Y")
x2 <- as.character(date())
x2_2 <- strptime(x2, "%a %b %d %H:%M:%S %Y")
X<-c(x1_2,x2_2)
order(X) ## I want to
15 matches
Mail list logo