Re: [R] x,y,z table to matrix with x as rows and y as columns

2007-07-24 Thread Mark Lyman
ix(unlist(split(z, interaction(x,y))), ncol=length(unique(y))) + dimnames(out) <- list(unique(x), unique(y)) + out + } > with(mydat, data2mat(x, y, z)) Mark Lyman __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] x,y,z table to matrix with x as rows and y as columns

2007-07-24 Thread Mark Lyman
n or trust that z is never 0 and replace all 0's with NA. > mydat <- expand.grid(x=1:5, y=1:5) > mydat <- data.frame(mydat, z=rnorm(25)) > mydat$z[sample(1:25,4)] <- NA > mytab <- xtabs(z~x+y, mydat) Mark Lyman __ R-help@stat

Re: [R] problems with character objects and calls to list()

2007-07-23 Thread Mark Lyman
> Really I'd like the call to list() to behave as though the text had > been entered directly so that you get > > > list(1:2, 3:4, 5:6) > [[1]] > [1] 1 2 > > [[2]] > [1] 3 4 > > [[3]] > [1] 5 6 > > eval(parse(text=paste("list(",to.convert,")",sep=""))) [[1]] [1] 1 2 [[2]] [1] 3 4 [[3]] [1

Re: [R] Adding points to a wireframe with conditioning variable

2007-07-05 Thread Mark Lyman
Deepayan Sarkar gmail.com> writes: > > On 7/5/07, Mark Lyman gmail.com> wrote: > > I would like to add points to a wireframe but with a conditioning variable. I > > found a solution for this without a conditioning variable here, > > http://finzi.psych.upenn.edu

[R] Adding points to a wireframe with conditioning variable

2007-07-05 Thread Mark Lyman
I would like to add points to a wireframe but with a conditioning variable. I found a solution for this without a conditioning variable here, http://finzi.psych.upenn.edu/R/Rhelp02a/archive/65321.html. Does anyone know how to plot a wireframe conditioned on a variable and add the points conditi

Re: [R] barchart (lattice) with text labels

2007-02-25 Thread Mark Lyman
nvals <- length(vals) height <- box.ratio/(1+ nvals * box.ratio) for (i in unique(y)) { ok <- y == levels(y)[i] nok <- sum(ok, na.rm = TRUE) panel.text(x = x[ok], y = (i + height * (groups[ok] - (nvals + 1)/2)), labels=as.character(signif(x[ok],2)), ...)

Re: [R] sapply again return value

2007-02-16 Thread Mark Lyman
Antje yahoo.de> writes: > Hello, > > I used an sapply to get some data back (s <- sapply(...) ). The output > of s would then deliver something like this: > > B06_lamp.csv C06_lamp.csv D06_lamp.csv > [1,] NULL NULL Numeric,512 > [2,] NULL NULL Numeric,512

Re: [R] plotting derived values not raw

2007-02-09 Thread Mark Lyman
he actual mean and standard error values. Is there a way to > do this in R? Thanks for any help in advance. > james I believe that xYplot in the Hmisc package will do what you want Mark Lyman __ R-help@stat.math.ethz.ch mailing list https://stat.

Re: [R] Using variable names in for loops - Generating plot s semi-automatically from a series of variables Partly solved

2007-02-09 Thread Mark Lyman
ormula would be: > plot(eval(parse(text=mynames[1])),eval(parse(text=mynames[2]))) > detach(mydata) Take a look at the help files for eval and parse. I still do not have a firm grasp on how to use them and other related functions, like substitute, but what I have been able figure out has been

Re: [R] LM Model

2007-02-09 Thread Mark Lyman
to do so? Or maybe somebody has another solution? > > Thanks in advance, > > Simon Here is one way. Take a look at help(offset), help(lm), and help(lm.predict). > xx <- runif(30) > yy <- rnorm(30) > mydata<-data.frame(xx,yy) > lm(yy~offset(15

Re: [R] Problem with fitted.value function

2006-11-17 Thread Mark Lyman
I don't know how to use the fitted > values function with a given function and given input-variables but yet > unknown result-values. Take a look at the predict function, ?predict. Mark Lyman __ R-help@stat.math.ethz.ch mailing

Re: [R] applying cor.test in two different but matched dataframes

2006-11-17 Thread Mark Lyman
t to Lists So that Each Element of List is a variable t.x<-as.list(as.data.frame(t(x))) t.y<-as.list(as.data.frame(t(y))) # Use mapply to apply function to the two lists; see ?mapply mapply(cor.test,t.x,t.y) Mark Lyman __ R-help@stat.math.ethz.ch m

Re: [R] update index in

2006-10-25 Thread Mark Lyman
> > Kim > I believe this will also do what you want: > days<-c(1:10)[-5:-7] > xx<-rnorm(7) > data<-data.frame(xx,days) > new.data<-merge(data,data.frame(days=1:10),all.y=TRUE) It usually is not a good idea to use zeroes as placeholders for missing values. Mar

Re: [R] Plotmath expression

2006-10-24 Thread Mark Lyman
Here is the code: > > ll <- c(x=10.1, sde=5.5) > plot(1:10) > text(x=9, y=2, pos=2, expression(paste(X[min], "=", paste(ll, > collapse="+/-" How about the following? text(x=9, y=2, pos=2,substitute(X[min]==x%+-%sde,as.list(ll))) Mark Lyman _

Re: [R] write data to pdf

2006-10-19 Thread Mark Lyman
Franco Mendolia gmx.de> writes: > > Hello! > > Is there a possibility in R to save data in pdf-format? > I do not want to save a plot but some lines of simple text. > > Regards, > > Franco Mendolia You could also use pdf() and textplot() in

Re: [R] How can I delete components in a column ?

2006-10-09 Thread Mark Lyman
none3 > d none 2 > ad cfh 4 > bf cdt 5 >empty 2 >empty 2 > gf cdh 4 > d none 5 > > and want to eliminate all components that have id=none and empty . The remaining data

[R] Incompatability of lme4 and Matrix packages

2006-10-09 Thread Mark Lyman
version. Mark Lyman __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] Help on apply() function

2006-08-29 Thread Mark Lyman
identical (see ?identical) to check if they are exactly the same. See the examples in the help for identical. Mark Lyman __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://w

Re: [R] Type II and III sum of square in Anova (R, car package)

2006-08-26 Thread Mark Lyman
the interaction and lm.fit2 does not. The anova function will return the appropriate F-test. The danger with worrying about what type of sums of squares to use is that often we do not think about what hypotheses we are testing and if those hypotheses make sense in our situation. Mark Lyman __

Re: [R] How to iteratively extract elements out of a list

2006-08-26 Thread Mark Lyman
lapply(m,function(x)x[x>2]) [[1]] [1] 3 4 [[2]] [1] 4 5 [[3]] [1] 4 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented

[R] Specify Z matrix with lmer function

2005-11-03 Thread Mark Lyman
Is there a way to specify a Z matrix using the lmer function, where the model is written as y = X*Beta + Z*u + e? I am trying to reproduce smoothing methods illustrated in the paper "Smoothing with Mixed Model Software" my Long Ngo and M.P. Wand. published in the /Journal of Statistical Softwar

Re: [R] Post Hoc Groupings

2005-10-26 Thread Mark Lyman
Looking at the errors your code produces, it looks like you need to make Dock and Slip factors. dock_2004_data$Dockf<-factor(dock_2004_data$Dock) dock_2004_data$Slipf<-factor(dock_2004_data$Slip) rich.aov <- aov(X.open ~ Dockf*Slipf, data=dock_2004_data) TukeyHSD(rich.aov, c("Dockf", "Slipf"))

Re: [R] Bug in lmer?

2005-09-30 Thread Mark Lyman
I am using version 0.98-7 of the Matrix package. I used the RGui "Install Packages..." menu option to get the lme4 package from CRAN and this version of the Matrix was automatically downloaded as well. Martin Maechler wrote: >>>>>>"Mark" == Mark Lyman &l

[R] Bug in lmer?

2005-09-29 Thread Mark Lyman
I am relatively new to R so I am not confident enough in what I am doing to be certain this is a bug. I am running R 2.1.1 on a Windows XP machine and the lme4 package version 0.98-1. The following code fits the model I want using the nlme package version 3.1-60. mltloc$loc <- factor(mltloc$loc

[R] lmer random effect model matrix question

2005-09-29 Thread Mark Lyman
I have one fixed effect, sor, with two levels. I have eight lots and three wafers from each lot. I have included the data below. I would like to fit a mixed model that estimates a covariance parameter for wafer, which is nested in lot, and two covariance parameters for lot, one for each level o