Thank you!
From: William Dunlap [mailto:wdun...@tibco.com]
Sent: Friday, January 23, 2015 7:14 PM
To: Tan, Richard
Cc: r-help@R-project.org
Subject: Re: [R] get latest dates for different people in a dataset
Here is one way. Sort the data.frame, first by Name then break ties with
CheckInDate
Thank you!
-Original Message-
From: Chel Hee Lee [mailto:chl...@mail.usask.ca]
Sent: Friday, January 23, 2015 8:09 PM
To: Tan, Richard; 'r-help@R-project.org'
Subject: Re: [R] get latest dates for different people in a dataset
> do.call(rbind, lapply(split(data, data$Name
Thank you!
-Original Message-
From: David Barron [mailto:dnbar...@gmail.com]
Sent: Saturday, January 24, 2015 7:56 AM
To: Tan, Richard; r-help@R-project.org
Subject: Re: [R] get latest dates for different people in a dataset
Hi Richard,
You could also do it using the package dplyr
Hi,
Can someone help for a R question?
I have a data set like:
NameCheckInDate Temp
John 1/3/2014 97
Mary 1/3/2014 98.1
Sam 1/4/2014 97.5
John 1/4/2014 99
I'd like to return a dataset that for each Name, get the ro
> result
item loc cat
1 item 1.1: earnings item 1.2: w2 shelf 1 AB
2 item 1.3: deductions drawer 1 C
3 item 1.1: earnings shelf 2 A
Thanks,
Richard
From: Tan, Richard
Sent: Wednesday, January 05,
Hi, I know I can do this with a for loop with strsplit and grep, but is
there more efficient way?
Given a data dataframe (input) and a category column (lst),
> input
item loc
1 item 1.1: earnings item 1.2: w2 shelf 1
2
onday, November 22, 2010 3:58 PM
To: Tan, Richard
Cc: r-help@r-project.org
Subject: Re: [R] aggregate a Date column does not work?
On Nov 22, 2010, at 3:54 PM, Tan, Richard wrote:
> Thanks, add as.Date('1970-01-01') to the result column works.
But that should make them all the same d
Thanks, add as.Date('1970-01-01') to the result column works.
Richard
-Original Message-
From: David Winsemius [mailto:dwinsem...@comcast.net]
Sent: Monday, November 22, 2010 3:51 PM
To: Tan, Richard
Cc: r-help@r-project.org
Subject: Re: [R] aggregate a Date column does not
Hi, I am trying to aggregate max a Date type column but have weird
result, how do I fix this?
> a <- rbind(
+ data.frame(name='Tom', payday=as.Date('1999-01-01')),
+ data.frame(name='Tom', payday=as.Date('2000-01-01')),
+ data.frame(name='Pete', payday=as.Date('1998-01-01')),
+ data.frame(n
Thank you!
Richard
-Original Message-
From: jim holtman [mailto:jholt...@gmail.com]
Sent: Thursday, October 07, 2010 12:08 PM
To: Tan, Richard
Cc: r-help@r-project.org
Subject: Re: [R] aggregate text column by a few rows
try this using sqldf:
> a
id name hobby
1 1 Tom fishin
Hi, R function aggregate can only take summary stats functions, can I
aggregate text columns? For example, for the dataframe below,
> a <- rbind(data.frame(id=1, name='Tom',
hobby='fishing'),data.frame(id=1, name='Tom',
hobby='reading'),data.frame(id=2, name='Mary',
hobby='reading'),data.fram
Thanks, it works.
Richard
From: Henrique Dallazuanna [mailto:www...@gmail.com]
Sent: Thursday, September 16, 2010 1:56 PM
To: Tan, Richard
Cc: RICHARD M. HEIBERGER; r-help@r-project.org
Subject: Re: [R] get top n rows group by a column from a dataframe
You can try this:
(Using
Hi Richard
Thanks for the suggestion, but I want top 5 salary for each company, not
the whole list. I don't see how your way can work?
Thanks,
Richard
From: RICHARD M. HEIBERGER [mailto:r...@temple.edu]
Sent: Thursday, September 16, 2010 11:53 AM
To: Tan, Richard
Cc: r-h
Hi, is there an R function like sql's TOP key word?
I have a dataframe that has 3 columns: company, person, salary
How do I get top 5 highest paid person for each company, and if I have
fewer than 5 people for a company, just return all of them?
Thanks,
Richard
[[alternati
Thanks all for the help!
-Original Message-
From: William Dunlap [mailto:wdun...@tibco.com]
Sent: Tuesday, March 09, 2010 5:58 PM
To: Phil Spector; Tan, Richard
Cc: r-help@r-project.org
Subject: RE: [R] data frame select max group by like function
And yet another way is
> isLastIn
Hi, I have a data frame with 3 columns: ID, year and score. How can I
select for each unique ID, the year that has the max score? For
example, for data frame
ID, year, score
tom, 1995, 88
rick, 1994, 90
mary, 2000, 97
tom, 1998, 60
mary, 1998,100
I shall have
ID, year, score
tom, 1995, 88
ric
Hello, can someone help? How come
> gsub("\bINDS\b","INDUSTRIES","ADVANCED ENERGY INDS")
[1] "ADVANCED ENERGY INDS"
not ADVANCED ENERGY INDUSTRIES
Thanks.
Richard
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing li
Ok, I figured it out. My stupid mistake, should be \\b instead of \b.
From: Tan, Richard
Sent: Tuesday, November 10, 2009 3:36 PM
To: 'r-help@r-project.org'
Subject: gsub does not support \b?
Hello, can someone help? How come
> g
e-
From: Wacek Kusnierczyk [mailto:waclaw.marcin.kusnierc...@idi.ntnu.no]
Sent: Tuesday, June 09, 2009 1:06 PM
To: Greg Snow
Cc: Marc Schwartz; Barry Rowlingson; r-help@r-project.org; Tan, Richard
Subject: Re: [R] Regex question to find a string that contains 5-9
alpha-numeric characters, at least one of
Hi,
This is not exactly an R question but I am trying to use gsub to replace
a string that contains 5-9 alpha-numeric characters, at least one of
which is a number. Is there a good way to write it in a one line regex?
Thanks,
Richard
__
R-help@r-proj
m: William Dunlap [mailto:wdun...@tibco.com]
Sent: Monday, April 13, 2009 1:17 PM
To: Tan, Richard; r-help@r-project.org
Subject: Re: [R] toupper does not work in sub + regex
You could also use \\U and \\L in the replacement with perl=TRUE. \\U
"converts the rest of the replacement to upper case&
Thanks, Martin. I did not realize that. I never used perl compatible
regex before but seems now I should!
Richard
-Original Message-
From: Martin Morgan [mailto:mtmor...@fhcrc.org]
Sent: Monday, April 13, 2009 12:08 PM
To: Tan, Richard
Subject: Re: [R] toupper does not work in sub
Hi, I don't know what I am doing wrong to the toupper does not seem
working in sub + regex. The following returns 's' not the upper class
'S' as I expect:
sub("q_([a-z])[a-zA-Z]*",toupper('\\1'),"q_sviRaw")
Can someone tell me where I did wrong?
Thanks,
Richard
[[alternative HTML ve
That works. I want the position just for the purpose of my later manual check.
Thanks a lot Gabor.
-Original Message-
From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com]
Sent: Friday, March 13, 2009 2:18 PM
To: Tan, Richard
Cc: r-help@r-project.org
Subject: Re: [R] search for
Hi, sorry if it is a too stupid question, but how do I a string search
in R:
I have a dataframe A with A$test like:
test1
bcdtestblabla2.1bla
cdtestblablabla3.88blabla
and I want to search for string that start with 'dtest' and ends with
number and return the location of that substring and th
Hi,
I posted a question a few days ago and got extremely well response.
https://stat.ethz.ch/pipermail/r-help/2009-February/188225.html. Now I
have a somewhat related question:
I have a correlation matrix of about 3000 items, with 1 on diagonal (
for example, cor.mat <- cor(matrix(rnorm(3000*1
Thank you, works!
-Original Message-
From: Rowe, Brian Lee Yung (Portfolio Analytics) [mailto:b_r...@ml.com]
Sent: Thursday, February 19, 2009 5:52 PM
To: Wacek Kusnierczyk; Tan, Richard
Cc: r-help@r-project.org
Subject: RE: [R] transform key value pair to column
Try this:
> du
Hi, is there a good way (instead of a time-consuming for loop) to
transfer a key/value pair dataframe to a dataframe with key as column
and value as row? For example, I have a dataframe with three columns:
id, code, value:
id,code,value
1,hi,10.3
1,lo,5.2
2,hi,19.4
3,hi,20
3,lo,12
4,lo,5.8
I w
Works like a charm, thank you!
-Original Message-
From: Dimitris Rizopoulos [mailto:d.rizopou...@erasmusmc.nl]
Sent: Thursday, February 12, 2009 12:11 PM
To: Tan, Richard
Cc: r-help@r-project.org
Subject: Re: [R] get top 50 correlated item from a correlation matrix
for each item
a
Hi,
I have a correlation matrix of about 3000 items, i.e., a 3000*3000
matrix. For each of the 3000 items, I want to get the top 50 items that
have the highest correlation with it (excluding itself) and generate a
data frame with 3 columns like ("ID", "ID2", "cor"), where ID is those
3000 items
30 matches
Mail list logo