I guess you can get the result by
1) concatenating all the variables (P2_A, P2_B, P2_C) into one variable ,
2) replicating segment membership properly,
3) make the table of 1) and 2)
For example, the following may do the job.
> ## (1) Generate data set
> # Set random seed
> set.seed(0)
>
> n.obs
Just adjust the formula for Qtr appropriately if your quarters
are not Jan/Feb/Mar, Apr/May/Jun, Jul/Aug/Sep, Oct/Nov/Dec
as I assumed.
On Dec 1, 2007 5:21 PM, Sherri Heck <[EMAIL PROTECTED]> wrote:
> Hi Gabor,
>
> Thank you for your help. I think I need to clarify a bit more. I am
> trying to s
Hi Gabor,
Thank you for your help. I think I need to clarify a bit more. I am
trying to say
average all 2pms for months march + april + may (for example). I hope this is
clearer.
here's a larger subset of my data set:
year, month, hour, co2(ppm), num1,num2
2006 1 0 384.2055 14 14
2006 1
Try aggregate:
Lines <- "Year Month Hour co2 num1 num2
2006 110 383.3709 28 28
2006 111 383.3709 28 28
2006 112 383.3709 28 28
2006 113 383.3709 28 28
2006 114 383.3709 28 28
2006 115 383.3709 28 28
2006 116 383.3709 28
Hi,All:
I have a question about specifying var-cov matrix in
mixed linear model using lme. For example, for
single-level mixed linear model:
yi = XiB + Ziui + ei
ui ~ N(0,D), ei ~ N(0,sigma^2R),
var(yi)=sigma^2(ZiAZi^T + R). R is an identify matrix
and A is a known var-covar matrix in my data.
In m
Mark Kimpel <[EMAIL PROTECTED]> [Sat, Dec 01, 2007 at 05:28:28PM CET]:
> What I would find useful would be some sort of tagging system for messages.
Hrm. I find tags immensely useful for entities which do not contain primarily
text, such as photos. I am at doubt how keywords are important when the
Hi all-
I have a dataset (year, month, hour, co2(ppm), num1,num2)
[49,] 2006 110 383.3709 28 28
[50,] 2006 111 383.3709 28 28
[51,] 2006 112 383.3709 28 28
[52,] 2006 113 383.3709 28 28
[53,] 2006 114 383.3709 28 28
[54,] 2006 115 383.3709
That's no table that's a data.frame :).
For what you want probably the easiest way is
aggregate. Type ?aggregate for the help information
Based on your example and assuming the data is called
"mydata" this shold do what you want.
aggregate(mydata[,2:3], by=list(item=mydata$Item),
sum)
---
Its a bit tricky if you want to get it to work exactly the same as
Excel even in the presence of runs but in terms of the R approx function
I think percentrank corresponds to ties = "min" if the value is among those
in the table and ties = "ordered" otherwise so:
percentrank <- function(table, x =
--- David Winsemius <[EMAIL PROTECTED]> wrote:
> "tom soyer" <[EMAIL PROTECTED]> wrote in
>
news:[EMAIL PROTECTED]:
>
>
> > John,
> >
> > The Excel's percentrank function works like this:
> if one has a number,
> > x for example, and one wants to know the
> percentile of this number in
> > a g
Dieter Menne wrote:
> Michael Hoffman sneakemail.com> writes:
>
>> I would like to be able to do something like this:
>>
>><>=
>>...
>>@
>>
>> with mywidth set in a previous code chunk. Is there a way to do this in
>> Sweave?
>>
>
> Not in the <<>>, but you could set a hook for fig:
On Sat, 2007-12-01 at 18:40 +, David Winsemius wrote:
> David Winsemius <[EMAIL PROTECTED]> wrote in
> news:[EMAIL PROTECTED]:
>
> > "tom soyer" <[EMAIL PROTECTED]> wrote in
> > news:[EMAIL PROTECTED]:
> >
> >> John,
> >>
> >> The Excel's percentrank function works like this: if one has a
On 01/12/2007 11:11 AM, Michael Hoffman wrote:
> I have been using Aspell on a Linux system, but it doesn't
> understand the noweb chunks, which I'd rather it not spellcheck. I
> can run it on the generated .tex files, but then changes I make
> during the spellcheck will not be propagated back to t
David Winsemius <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> "tom soyer" <[EMAIL PROTECTED]> wrote in
> news:[EMAIL PROTECTED]:
>
>> John,
>>
>> The Excel's percentrank function works like this: if one has a number,
>> x for example, and one wants to know the percentile of this numbe
"tom soyer" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> John,
>
> The Excel's percentrank function works like this: if one has a number,
> x for example, and one wants to know the percentile of this number in
> a given data set, dataset, one would type =percentrank(dataset,x) in
> Exc
Note that read.table() reads a table and returns a _data frame_. So it is
the _data frame_ that you want to change (a table is something else in R).
This is a simple application of aggregate(), e.g.
> aggregate(z[-1], list(Item=z$Item), sum)
Item X3d_Plot XY_plot
111 2
2
Hi all:
Im kind of new on R and I need help changing a table. The thing is, i read a
file on R using the read.table command and the table looks like this:
Item 3d Plot XY plot
001 1 0
001 0 1
001 0
On Dec 1, 2007 10:08 AM, Dieter Menne <[EMAIL PROTECTED]> wrote:
> Douglas Bates stat.wisc.edu> writes:
>
> (lmer)
>
> > The default is PQL, to refine the
> > starting estimates, followed by optimization of the Laplace
> > approximation. In some cases it is an advantage to suppress the PQL
> > it
John,
The Excel's percentrank function works like this: if one has a number, x for
example, and one wants to know the percentile of this number in a given data
set, dataset, one would type =percentrank(dataset,x) in Excel to calculate
the percentile. So for example, if the data set is c(1:10), and
Michael Hoffman sneakemail.com> writes:
>
> I would like to be able to do something like this:
>
><>=
>...
>@
>
> with mywidth set in a previous code chunk. Is there a way to do this in
> Sweave?
>
Not in the <<>>, but you could set a hook for fig:
>From Sweave docs:
If optio
I don't think r-help is really intended for packages although for some
very popular packages questions appear on it anyways sometimes.
On Dec 1, 2007 11:28 AM, Mark Kimpel <[EMAIL PROTECTED]> wrote:
> I'll throw one more idea into the mix. I agree with Bill that a rating
> system for respondents i
I don't see one but that means nothing. I think you
can write such a function in a few minutes
Will something like this work or am I
missunderstanding what Excel's percentrank does ?
aa <- rnorm(25); aa # data vector
percentrank <- function(x) {
var <- sort(x)
p.rank <- 1:length(var)/lengt
I'll throw one more idea into the mix. I agree with Bill that a rating
system for respondents is probably not that practical and of not the highest
importance. It also seems like a recipe for creating inter-personal problems
that the list doesn't need.
I do like Bill's idea of a review system for
I would like to be able to do something like this:
<>=
...
@
with mywidth set in a previous code chunk. Is there a way to do this in
Sweave?
(Sorry for two questions in a row, I have been saving these up.)
--
Michael
__
R-help@r-project.org
Why exactly the same question?
You were told what to do.
I am new to R. I did what the previous poster said.
I found it. Write your function in terms of vector operations. Avoid
loops if you can.
Sample input for R follows
-
# par is the thing that has to be found
# x
Hi,
I encountered this problem when I was looking around in R, by default
R is built with --enable-mcfs and when I tried to edit any data I was
getting:
dataentry(datalist, modes) : invalid device
unable to create fontset -*-fixed-medium-r-normal--13-*-*-*-*-*-*-*
anyway I looked around code, no
Douglas Bates stat.wisc.edu> writes:
(lmer)
> The default is PQL, to refine the
> starting estimates, followed by optimization of the Laplace
> approximation. In some cases it is an advantage to suppress the PQL
> iterations which can be done with one of the settings for the control
> argument.
I have been using Aspell on a Linux system, but it doesn't
understand the noweb chunks, which I'd rather it not spellcheck. I
can run it on the generated .tex files, but then changes I make
during the spellcheck will not be propagated back to the original
source. Any suggestions on how to spellchec
Thanks Jim! That helped me a lot!
Cheers,
Lauri
2007/12/1, jim holtman <[EMAIL PROTECTED]>:
> This should do it for you by padding out the rows so they are the same length:
>
> > # use your 'g' and pad out the rows so they are the same length
> > str(g)
> List of 5
> $ x:'data.frame': 3 obs
On Dec 1, 2007 9:26 AM, Douglas Bates <[EMAIL PROTECTED]> wrote:
> On Nov 29, 2007 8:09 PM, M-J Milloy <[EMAIL PROTECTED]> wrote:
> >
> > Hello all,
> >
> > I'm attempting to fit a generalized linear mixed-effects model using lmer
> > (R v 2.6.0, lmer 0.99875-9, Mac OS X 10.4.10) using the call:
>
On Nov 29, 2007 8:09 PM, M-J Milloy <[EMAIL PROTECTED]> wrote:
>
> Hello all,
>
> I'm attempting to fit a generalized linear mixed-effects model using lmer
> (R v 2.6.0, lmer 0.99875-9, Mac OS X 10.4.10) using the call:
>
> vidusLMER1 <- lmer(jail ~ visit + gender + house + cokefreq + cracfreq +
>
This should do it for you by padding out the rows so they are the same length:
> # use your 'g' and pad out the rows so they are the same length
> str(g)
List of 5
$ x:'data.frame': 3 obs. of 2 variables:
..$ x : Factor w/ 3 levels "1","2","3": 1 2 3
..$ Freq: int [1:3] 9 9 8
$ y
On Dec 1, 2007 2:21 AM, <[EMAIL PROTECTED]> wrote:
> To me a much more urgent initiative is some kind of user online review
> system for packages, even something as simple as that used by Amazon.com
> has for customer review of books.
>
> I think the need for this is rather urgent, in fact. Most
#Hi R-users,
#Suppose that I have a data.frame like this:
y1 <- rnorm(10) + 6.8
y2 <- rnorm(10) + (1:10*1.7 + 1)
y3 <- rnorm(10) + (1:10*6.7 + 3.7)
y <- c(y1,y2,y3)
x <- rep(1:3,10)
f <- gl(2,15, labels=paste("lev", 1:2, sep=""))
g <- seq(as.Date("2000/1/1"), by="day", length=30)
DF <- data.frame(
Hello, I'm new using R and developing tables.
I have a problem in developing a table. In a questionaire I made I ask this
question "Please tell me the first three sympthoms caused by Respiratory
tract infection you've caught this year", then the people answer three
sympthoms, the first mention (
Dear R-helper:
I measured 40 different mouse strains. In 10 of them, I measured 2 males and
4 females for each strain. In another 10 of them, I measured 4 males and 2
females for each strain. In the remaining 20, I measured 3 males and 3 females
for each strain. Totally, I have 240 data for 40
Hi R,
I want to do some rolling correlations. But before, I searched for
"?rollingCorrelation" and tried the example in it. But I was not
successful. What could be the problem? Here is the code I tried:
> library(zoo)
> library(PerformanceAnalytics)
> rollingCorrelation([EMAIL PROTECTED],
Hi,
Does anyone know if R has a built-in function that is equvalent to Excel's
percentrank, i.e., returns the rank of a value in a data set as a percentage
of the data set?
Thanks,
--
Tom
[[alternative HTML version deleted]]
__
R-help@r-proj
Good afternoon!
I'm trying to model a time series on the following data, which represent a
monthly consumption of juices:
>x<-scan()
1: 2859 3613 3930 5193 4523 3226 4280 3436 3235 3379 3517 6022
13: 4465 4604 5441 6575 6092 6607 6390 6150 6488 5912 6228 10196
25: 7612 72
Peter Dalgaard wrote:
> Also, extending the above slightly:
>
Oups. Two lines fell out. I meant:
> y <- factor(c("b","c","b"))
> x <- factor(c("a","b","b"))
> d <- as.character(x)==as.character(y)
> table(d)
d
FALSE TRUE
2 1
> which(!d)
[1] 1 2
--
O__ Peter Dalgaard
Bernd Jagla wrote:
> It helps writing down these question, you are then getting much closer to an
> answer...
>
> summary(as.integer(t3[,2]) == as.integer(t3[,4]) & as.integer(t3[,3]) ==
> as.integer(t3[,5]))
>
> will compare two pairs of column pairs and give a count of flase and true
> rows...
>
41 matches
Mail list logo