adolfpf wrote:
How do I group my data in dolf the same way the data Orthodont are
grouped.
show(dolf)
distance age Subjectt Sex
16.83679 22.01 F1 F
26.63245 23.04 F1 F
3 11.58730 39.26 M2 M
I know that many sample in that excellent book use
?cut
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Jason Rupert
Sent: Saturday, March 05, 2011 3:38 PM
To:
Hi Jason,
Something along the lines of
with(Orange, table(cut(age, breaks = c(118, 664, 1004, 1372, 1582, Inf)),
cut(circumference, breaks = c(30, 58, 62, 115,
145, 179, 214
should get you started.
HTH,
Jorge
On Sat, Mar 5, 2011 at 5:38 PM, Jason Rupert wrote:
Hi Steve,
Just test whether y is greater than the predicted y (i.e., your line).
## function using the model coefficients*
f - function(x) {82.9996 + (.5589 * x)}
## Find group membership
group - ifelse(y foo(x), A, B)
*Note that depending how accurate this needs to be, you will probably
want
table is reasonably fast. I have more than 4 X 10^6 records and a 2D
table takes very little time:
nUA - with (TRdta, table(URwbc, URrbc)) # both URwbc and URrbc are
factors
nUA
This does the same thing and took about 5 seconds just now:
xtabs( ~ URwbc + URrbc, data=TRdta)
On Sep 2,
...@r-project.org] On
Behalf Of David Winsemius
Sent: Wednesday, September 02, 2009 3:59 PM
To: Leo Alekseyev
Cc: r-help@r-project.org
Subject: Re: [R] Grouping data in a data frame: is there an efficient way
todo it?
table is reasonably fast. I have more than 4 X 10^6 records and a 2D
table takes
Take 0.6 seconds on my slow laptop:
n - 1e6
x - data.frame(a=sample(LETTERS, n, TRUE))
system.time(print(tapply(x$a, x$a, length)))
A B C D E F G H I J K
L M N O P Q
38555 38349 38647 38271 38456 38352 38644 38679 38575 38730
You may want to try using isplit (from the iterators package). Combined with
foreach, it's an efficient way of iterating through a data frame by groups
of rows defined by common values of a columns (which I think is what you're
after). You can speed things up further if you have a multiprocessor
Thanks everyone for the useful suggestions. The bottleneck might be
memory limitations of my machine (3.2GHz, 2 GB) and the fact that I am
aggregating on a field that is a string. Using the suggested
as.data.frame(table(my.df$my.field)) I do get a speedup, but the
computation still takes 30
Hi there,
I think the option of 30 seconds is ok because it is less than each one
expent reading the messages :-) Just kiding...
bests
milton
On Wed, Sep 2, 2009 at 8:01 PM, Leo Alekseyev dnqu...@gmail.com wrote:
Thanks everyone for the useful suggestions. The bottleneck might be
memory
Timo Schneider wrote:
I have a dataframe (obtained from read.table()) which looks like
ExpA ExpB ExpC Size
1 12 2333 1
2 12 2429 1
3 10 2234 1
4 25 5060 2
5 24 5362 2
6 21
Another approach is to use the reshape package
--Assuming your data.frame is called xx
--
libarary(reshape)
mm - melt(xx, id=c(Size)) ; mm
cast(mm, Size ~variable, median)
--
--- On Tue, 7/14/09, Timo Schneider
Am Mittwoch, den 15.07.2009, 00:42 -0500 schrieb markle...@verizon.net:
Hi!
Hi: I think aggregate does what you want. you had 34 in one of your
columns but I think you meant it to be 33.
DF - read.table(textConnection(ExpA ExpB ExpC Size
1 12 23 33 1
2 12 24 29 1
3 10 22 34 1
4 25 50 60
Tena koe Timo
?aggregate
HTH ...
Peter Alspach
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Timo Schneider
Sent: Wednesday, 15 July 2009 3:56 p.m.
To: r-help@r-project.org
Subject: [R] Grouping data in dataframe
Try ?aggregate
--- On Wed, 15/7/09, Timo Schneider timo.schnei...@s2004.tu-chemnitz.de wrote:
From: Timo Schneider timo.schnei...@s2004.tu-chemnitz.de
Subject: [R] Grouping data in dataframe
To: r-help@r-project.org r-help@r-project.org
Received: Wednesday, 15 July, 2009, 1:56 PM
Hello,
Hi,
i have group all the data, but now if i would want to sum all the rank in
each group, how can i do it?
ie. i want to sum the rank in every group, not total. so there will be a sum
of rank for month Jan,Feb,.Dec, therefore there will be total of 12
vaule of ranking sum.
many thanks,
--
If your grouping is a list, then you can use 'sapply'; e.g.,
sapply(yourRanking, function(x) sum(x$rank)) # or whatever you want the sum of.
On Sun, Nov 9, 2008 at 4:00 PM, Swanton0822 [EMAIL PROTECTED] wrote:
Hi,
i have group all the data, but now if i would want to sum all the rank in
. http://www.nabble.com/file/p20392420/kew.dat kew.dat
Hi,
i did something wrong,
with the data attach all i want is 12 groups for the months like this:(group
1=group Jan,..group12= group Dec)
group 1 group 2 group 3.. group 12
and inside each group is the vaule of
A very simple but long way to do this would be to subset your data set. There
are better ways but this way would be easy to understand.
January - subset(mydata, Month==January)
Repeat for each month.
--- On Fri, 11/7/08, Swanton0822 [EMAIL PROTECTED] wrote:
From: Swanton0822 [EMAIL
hi friend,
this is from your previous posts on Kruskal-Wallis test:)
i came up with this one:
A5 - read.table('kew.dat' ,header=TRUE)
plot(factor(A5$Month, levels=month.abb), A5$Rain)
is that what you want?
On Sat, Nov 8, 2008 at 7:03 AM, Swanton0822 [EMAIL PROTECTED] wrote:
Hi.
i have a
If you provide the input and the expected output, it would help a lot.
You could use 'split' to partition the data
monthly - split(yourDF, yourDF$month)
but I am still not sure exactly what you want to do with it, or the
format that you are expecting.
On Fri, Nov 7, 2008 at 6:03 PM,
Tobin, Jared wrote:
Hello r-help,
I have a lengthy vector of data (with values anywhere from 1-200), and
another index vector of 'groups' representing values 0-2, 3-5, 6-8, ...
of length 67. The index vector has the structure (1, 4, 7, ... , 196,
199), where each value is the midpoint of
You might want to have a look at the recode function
in the car package. By the way I think you meant
26-35 not 25-25.
===
Example
xx - data.frame(age=c(25, 33, 22, 19,21, 30, 32,
31),
edu=c(2,5 ,3, 1,3, 4, 4, 1))
library(car)
Hi Kimmo,
try cut() to create a factor with levels according to the range of
values, and (among other options) table() to make the table.
Cheers
Andrew.
On Wed, Jan 16, 2008 at 10:06:23PM +0200, K. Elo wrote:
Hi,
I am quite new to R (but like it very much!), so please apologize if
this
K. Elo wrote:
Hi,
I am quite new to R (but like it very much!), so please apologize if
this is a too simple question.
I have a large data frame consisting of data from a survey. There is,
for example, information about age and education (a numeric value from
1-9). Now I would like to
25 matches
Mail list logo