All the examples in 'nlme' are in "Grouped Data: distance ~ age | Subject"
format.
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
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 exc
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
2011 3:38 PM
> To: R Project Help
> Subject: [R] Grouping data in ranges in table
>
> Working with the built in R data set Orange, e.g. with(Orange,
> table(age,
> circumference)).
>
>
> How should I go about about grouping the ages and circumferences in the
> follow
Working with the built in R data set Orange, e.g. with(Orange, table(age,
circumference)).
How should I go about about grouping the ages and circumferences in the
following ranges and having them display as such in a table?
age range:
118 - 664
1004 - 1372
1582
circumference range:
30-58
62-
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
Hi R-list,
I have a data set with plot locations and observations and want to label
them based on locations. For example, I have GPS information (x and y) as
follows:
> x
[1] -87.85092 -87.85092 -87.85092 -87.85093 -87.85093 -87.85093 -87.85094
[8] -87.85094 -87.85094 -87.85096 -87.85095 -87
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 wrote:
> Thanks everyone for the useful suggestions. The bottleneck might be
> memory limitations of my
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 secon
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 sy
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
...@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
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, 20
I have a data frame with about 10^6 rows; I want to group the data
according to entries in one of the columns and do something with it.
For instance, suppose I want to count up the number of elements in
each group. I tried something like aggregate(my.df$my.field,
list(my.df$my.field), length) but
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
imo Schneider wrote:
> From: Timo Schneider
> Subject: [R] Grouping data in dataframe
> To: "r-help@r-project.org"
> Received: Tuesday, July 14, 2009, 11:56 PM
> Hello,
>
> I have a dataframe (obtained from read.table()) which looks
> like
>
>
> Exp
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
Try ?aggregate
--- On Wed, 15/7/09, Timo Schneider wrote:
> From: Timo Schneider
> Subject: [R] Grouping data in dataframe
> To: "r-help@r-project.org"
> Received: Wednesday, 15 July, 2009, 1:56 PM
> Hello,
>
> I have a dataframe (obtained from r
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
Hello,
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 4961 2
now I want to
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
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,
--
Vie
m: Swanton0822 <[EMAIL PROTECTED]>
> Subject: [R] grouping data together
> To: r-help@r-project.org
> Received: Friday, November 7, 2008, 6:03 PM
> Hi.
> i have a data, and there is 3 columns, Month, Year and
> Total. and there is
> over 1000 rows for them because there
. 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 t
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, Swanton082
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 hav
Hi.
i have a data, and there is 3 columns, Month, Year and Total. and there is
over 1000 rows for them because there is 87 years data for every month, so
there is month from Jan-Dec, and year from 1900-1987,
so i was wondering if i would want to make 12 groups (Jan,Feb...,Dec),
and put each ye
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
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 each respective group.
I'm
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)
a
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 t
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
> thi
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 extract the total amoun
Hi
I am trying to run a mixed effects model taking into account that i sampled
in the same locations four times i.e. temporal repeated measures. From what
i gathered i need to group my data by my repeated measure - time - and state
the structure of my random variables so i tried this:
mixedmodel<
Bricklemyer, Ross S wrote:
> I am attempting to write a routine where I can run PAM (partition around
> mediods) on a dataset containing multiple soil cores and PCA spectral data
> from several depths per core. I want to run PAM on each individual core, so
> I need to group the data by core to
I am attempting to write a routine where I can run PAM (partition around
mediods) on a dataset containing multiple soil cores and PCA spectral data from
several depths per core. I want to run PAM on each individual core, so I need
to group the data by core to run the analysis. Below is an exam
36 matches
Mail list logo