Re: [R] LM with summation function

2012-05-22 Thread Peter Ehlers
= e)) # z1 z2 z3 # 100 10 -1 Peter Ehlers On 2012-05-22 09:43, Robbie Edwards wrote: I don't think I can. For the sample data d- data.frame(x=c(1, 4, 9, 12), s=c(109, 1200, 5325, 8216)) when x = 4, s = 1200. However, that s4 is sum of y1 + y2 + y3 + y4. Wouldn't I have to know the y

Re: [R] Stepwise with AICc

2012-05-21 Thread Peter Ehlers
) was immediate. Do I need to go down another route to get to the source of extractAIC? With thanks for any help you may offer, Julia You probably want extractAIC.lm (see what methods are available with methods(extractAIC)). Get the code with stats:::extractAIC.lm Peter Ehlers

Re: [R] Syntax for lme function to model random factors and interactions

2012-05-21 Thread Peter Ehlers
, but I find R very difficult to use, even after looking up its built-in help. Just a small comment, since you're interested in correct syntax: you apparently consider A*B to represent the (A,B) interaction term; in R, it's A:B and this *is* clearly documented in the help pages. Peter Ehlers I

Re: [R] nls and if statements

2012-05-17 Thread Peter Ehlers
of Cfl~Pw and Cfl~Tsoil says to me that you have far too much variability to fit your model. You might find this plot instructive: library(rgl) plot3d(Pw, Tsoil, Cfl, col=1+(Pw5), size=5) Peter Ehlers __ R-help@r-project.org mailing list https

Re: [R] max value

2012-05-15 Thread Peter Ehlers
(2,3,18), x = gl(3,1,18), y = sample(11:15, 18, replace=TRUE)) library(plyr) ddply(d, .(subject, session), transform, z = ifelse(y == max(y), 1, 0)) Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] labels in hist and ranges of an axis

2012-05-15 Thread Peter Ehlers
to accommodate tall bars. Peter Ehlers On 2012-05-14 04:32, Gerrit Eichner wrote: Carol, it is not clear to me which function histogram() you use (package lattice, package histogram ...?), but -- if it is not a lattice function -- a quick hack _might_ be to use par( cex = 2) or whatever magnification

Re: [R] Plotmath bug or my misunderstanding?

2012-05-12 Thread Peter Ehlers
for the unit. As for the 'cex=1:2' specification, only the first value is used. Cheers, Peter Ehlers On 2012-05-12 14:05, Bert Gunter wrote: This is a followup to a recent post on using atop() to obtain multiline expressions. My reading of the plotmath docs makes it clear that issuing (in base graphics

Re: [R] Simple plot loop

2012-05-03 Thread Peter Ehlers
Ben, I think that your original for-loop would work if you just replaced the 'i' in the lines() call with 'Data2[,i]': for (i in 2:length(Data2)) { lines(MONTH, Data2[, i], type=o, pch=22, lty=2, col=blue) } Peter Ehlers On 2012-05-03 07:04, Ben Neal wrote: Jim, thanks

Re: [R] Hyperspec package: need to change spectra names in a stacked plot

2012-04-28 Thread Peter Ehlers
? Your code is not reproducible. (And do use TRUE instead of T; sooner or later it *will* bite you.) I think that you might be able to accomplish what I think you want by setting the argument axis.args, e.g. plot(x, stacked=TRUE, axis.args = list(y = list(c(apple, banana, Peter

Re: [R] Hmisc::xYplot - text on xaxis

2012-04-28 Thread Peter Ehlers
(Cbind(x,xlower,xupper) ~ mo,data=foo) Just set the 'scales=' argument, e.g. xYplot(Cbind(x,xlower,xupper) ~ mo,data=foo, scales = list(at = 1:12, labels = month.abb)) Peter Ehlers # example 2: doesn't work xYplot(Cbind(x,xlower,xupper) ~ mo.fac,data=foo

Re: [R] Problem with Tukey test

2012-04-20 Thread Peter Ehlers
? Peter Ehlers __ R-help@r-project.org 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] Amelia error

2012-04-18 Thread Peter Ehlers
of str(ad04) than the above useless summary. Peter Ehlers aout04- amelia(ad04,noms=c(race,south,gender,demrep), m=5) Error in if (sum(non.vary == 0)) { : argument is not interpretable as logical In addition: Warning message: In FUN(X[[34L]], ...) : NAs introduced by coercion On Wed, Apr 18, 2012

Re: [R] Problems with subset, droplevels and lm: variable lengths differ

2012-04-16 Thread Peter Ehlers
, : variable lengths differ (found for 'litho') Michael, Unless I'm missing something, don't you just have to drop the quotes in your cbind()? Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] How to adjust the distance between legend and the plot (xyplot)

2012-04-16 Thread Peter Ehlers
( xlab.key.padding = 5 )), key = list( etc Peter Ehlers Here is the sample code I have == xyplot (1~1,key=list(space='bottom',columns=2,text=list(c('a','b','c','d')), lines =list(lwd=2,pch=c(1,1,2,2),cex=1.2,col=c(1,2,3,4),type=c('p

Re: [R] How to adjust the distance between legend and the plot (xyplot)

2012-04-16 Thread Peter Ehlers
that were wanted for the final report. It wasn't hard to figure out that lattice.heights was a list of height parameters and that things like xlab.key.padding affected the spacing between the xlab and the key. That's the beauty of R's interactive nature - it's easy to experiment. Peter Ehlers Jun

Re: [R] xyplot type=l

2012-04-15 Thread Peter Ehlers
) Peter Ehlers Thanks E. [[alternative HTML version deleted]] __ R-help@r-project.org 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

Re: [R] xyplot type=l

2012-04-15 Thread Peter Ehlers
On 2012-04-15 09:31, David Winsemius wrote: On Apr 15, 2012, at 11:54 AM, Peter Ehlers wrote: On 2012-04-15 03:19, Eiko Fried wrote: Probably a stupidly simple question, but I wouldn't know how to google it: xyplot(neuro ~ time | UserID, data=data_sub) creates a proper plot. However, if I

Re: [R] Stepwise procedure with force.in command

2012-04-09 Thread Peter Ehlers
() or for stepAIC() in pkg MASS tells you that there's a scope= argument which should do what you want. Peter Ehlers Thanks a lot, Hien __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

Re: [R] R help

2012-04-07 Thread Peter Ehlers
variables. How can I do that in R? Personally, I think that what you propose is scientific nonsense. But if you must do this, you might check out the leaps package. Peter Ehlers -- View this message in context: http://r.789695.n4.nabble.com/R-help-tp4539571p4539571.html Sent from the R help mailing

Re: [R] integrate function - error -integration not occurring with last few rows

2012-04-06 Thread Peter Ehlers
*:length(comb1$ID)) This is a good example to show that it's usually better to use seq_along() or seq_len() instead of 1:x. Peter Ehlers It works correctly as expected Thanks again. Navin On Fri, Apr 6, 2012 at 9:56 AM, Berend Hasselmanb...@xs4all.nl wrote: On 06-04-2012, at 13:14

Re: [R] Shapiro-Wilk cpoefficients: 2 Qs

2012-04-04 Thread Peter Ehlers
the constants used in swilk.c (in the R sources) which is a translation of the Fortran code at http://lib.stat.cmu.edu/apstat/R94. Peter Ehlers With thanks, Ted. - E-Mail: (Ted Harding)ted.hard...@wlandres.net Date: 04-Apr-2012 Time: 23:06:32

Re: [R] Subscript Error

2012-04-04 Thread Peter Ehlers
. Hmm, this list is generally more polite. Peter Ehlers -- View this message in context: http://r.789695.n4.nabble.com/Subscript-Error-tp4533219p4533219.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

Re: [R] A contour plot question - vis.gam () function in mgcv

2012-04-03 Thread Peter Ehlers
(., add = TRUE) Peter Ehlers On Tue, Apr 3, 2012 at 2:48 PM, Ravi Varadhanrvarad...@jhmi.edu wrote: Hi, Please see the attached contour plot (I am sorry about the big file). This was created using the vis.gam() function in mgcv package. However, my question is somewhat broader

Re: [R] Non-linear least squares

2012-04-02 Thread Peter Ehlers
ignore it. (2) To force a parameter to be positive, see ?SSasymp or for your case, perhaps ?SSasympOrig. Peter Ehlers Many thanks, Nic Surawski. -- View this message in context: http://r.789695.n4.nabble.com/Non-linear-least-squares-tp4524812p4524812.html Sent from the R help mailing list archive

Re: [R] Error: (subscript) logical subscript too long

2012-04-02 Thread Peter Ehlers
? I think that you don't understand the 'family=' argument in glm (nor, perhaps, generalized linear models as such). Hint: check ?family. Peter Ehlers Best regards, Ioanna __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] help interpreting aov results

2012-03-31 Thread Peter Ehlers
distinguishes statistics from high-energy physics. Peter Ehlers __ R-help@r-project.org 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

Re: [R] removing NA from multidmension arrays

2012-03-30 Thread Peter Ehlers
) if(any(!is.na(y))) y))) Hope this helps, Rui Barradas Or use complete.cases(): apply(x, 3, function(mat) mat[complete.cases(mat), ]) Peter Ehlers -- View this message in context: http://r.789695.n4.nabble.com/removing-NA-from-multidmension-arrays-tp4519369p4519750.html Sent from the R help

Re: [R] list assignment syntax?

2012-03-30 Thread Peter Ehlers
that f return a list, then you could use (c, d) - unlist(f(a, b)) to get vector (c, d). Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting

Re: [R] rep with bigz in gmp

2012-03-28 Thread Peter Ehlers
be an integer, which presumably excludes a vector of integers (cf ?rep.bigz and ?rep). Arguably, it might be (marginally) worthwhile for rep.bigz to spit out a warning message (something like that from if() when that function is fed a condition of length 1). Peter Ehlers

Re: [R] Help on predict.lm

2012-03-27 Thread Peter Ehlers
clearly stated there. Peter Ehlers On 2012-03-27 10:24, Nederjaard wrote: Hello, I'm new here, but will try to be as specific and complete as possible. I'm trying to use “lm“ to first estimate parameter values from a set of calibration measurements, and then later to use those estimates

Re: [R] Help on predict.lm

2012-03-27 Thread Peter Ehlers
there. Peter Ehlers On 2012-03-27 10:24, Nederjaard wrote: Hello, I'm new here, but will try to be as specific and complete as possible. I'm trying to use “lm“ to first estimate parameter values from a set of calibration measurements, and then later to use those estimates to calculate another set

Re: [R] What error distribution should I use?

2012-03-27 Thread Peter Ehlers
-help/2012-March/307352.html Peter Ehlers __ R-help@r-project.org 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

Re: [R] trellis plot

2012-03-26 Thread Peter Ehlers
of the 'groups' argument. col.symbol = disruption + 1 or, better, for arbitrary colours: mycols - c(2, 5) xyplot(, col.symbol = mycols[disruption + 1], ) Peter Ehlers Thank you in advance! __ R-help@r

Re: [R] trellis plot

2012-03-26 Thread Peter Ehlers
(..., col.symbol = mycols[dat$disruption[subscripts] + 1])}) BTW, your method of creating the data frame is unnecessarily complex. It would suffice to use dat - data.frame(person, time, etc) Peter Ehlers Hi everyone, I am just trying to figure out how to do a xyplot where

Re: [R] Error during wrapup: incorrect number of dimensions

2012-03-26 Thread Peter Ehlers
On 2012-03-26 12:57, Sam Steingold wrote: when subsetting a matrix results in a single row, it is converted to a vector, not a matrix. how do I avoid this? Check ?[ and note the 'drop=' argument. Peter Ehlers 1. __GOOD__ edges- get.edges(g,E(g)) edges [,1] [,2] [1,]02

Re: [R] circles()

2012-03-26 Thread Peter Ehlers
google. If this is the function circles() in package tripack, then I don't think you can do what you want. Just look at the code - it's a very small function. But why not use the symbols() function? It has a 'bg' argument. Peter Ehlers Thanks! John Muccigrosso

Re: [R] Recommendations regarding textbooks

2012-03-22 Thread Peter Ehlers
hand, if you're talking about R programming, then I can recommend A First Course in Statistical Programming with R by John Braun and Duncan Murdoch as a very nice introduction. Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] writing data to file

2012-03-22 Thread Peter Ehlers
help to solve the problem? Thanks in advance. deb You're using the wrong function; use write.table() instead. You may want to set either or both of the arguments 'quote' and 'row.names' to FALSE. Peter Ehlers __ R-help@r-project.org mailing list https

Re: [R] Randomly select elements based on criteria

2012-03-22 Thread Peter Ehlers
){ if(length(unique(d[,'fam'])) 2) stop('only one family') d2 - ddply(d,.(fam),function(x)x[sample(nrow(x), 1), ]) d2[sample(nrow(d2), 2), ] } Peter Ehlers On 2012-03-22 16:03, Jorge I Velez wrote: You could avoid the loop to run for ever by introducing a stop() check. Here is an example

Re: [R] barplot on map

2012-03-22 Thread Peter Ehlers
Check out the subplot() function in the TeachingDemos package. Peter Ehlers On 2012-03-22 12:28, Martin Renner wrote: I used the function stars() to make barplot-like plots on a map. Now editor wants us to use more traditional vertical barplots. Does anybody already have some code that would

Re: [R] Best way to compute the difference between two levels of a factor ?

2012-03-21 Thread Peter Ehlers
package: library(plyr) result - ddply(data, ID, summarize, DIF.X = X[TIME==T2] - X[TIME==T1], DIF.Y = Y[TIME==T2] - Y[TIME==T1]) Peter Ehlers Thanks in advance Sylvain Clément __ R-help@r-project.org mailing list https

Re: [R] Best way to compute the difference between two levels of a factor ?

2012-03-21 Thread Peter Ehlers
- with(data, aggregate(data[,-(1:2)], by=list(ID), FUN=diff)) This assumes that the dataframe is sorted as in your example. If that's not the case, then use order to arrange it first: data - with(data, data[order(ID, TIME), ]) Peter Ehlers Le 21/03/12 11:03, Peter Ehlers

Re: [R] Graphic legend with mathematical symbol, numeric variable and character variable

2012-03-21 Thread Peter Ehlers
(types, ~~tau==, mytau, sep='~')) plot(0) legend('topright', legend=leg) The '~' symbols generate spaces; use more if you want more spacing. Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Best way to compute the difference between two levels of a factor ?

2012-03-21 Thread Peter Ehlers
Here's the plyr way I should have thought of earlier: require(plyr) ddply(data, ID, numcolwise(diff)) Still requires your data to be ordered. Peter Ehlers On 2012-03-21 04:51, Eik Vettorazzi wrote: Hi Sylvain, assuming your data frame is ordered by ID and TIME, how about this aggregate

Re: [R] Graphic legend with mathematical symbol, numeric variable and character variable

2012-03-21 Thread Peter Ehlers
]) )[2] plot(0);legend(x=topright,legend=leg) The idea is to create an expression vector and then fill its components appropriately. We need the second component of the substitute call. Peter Ehlers On 2012-03-21 06:49, ECOTIÈRE David (Responsable d'activité) - CETE Est/LRPC de Strasbourg/6

Re: [R] 'Unexpected numeric constant'

2012-03-19 Thread Peter Ehlers
of these names in your code. But since it's generally better to use T1A[[name]] rather than T1A$name anyway, the need for quotes should not be a problem. Still, I wouldn't use illegal names. Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] regression with proportion data

2012-03-19 Thread Peter Ehlers
vector of number of trials as the 'weights' argument in the glm() call. See the Details section of ?glm. Peter Ehlers S Ellison*** This email and any attachments are confidential. Any use...{{dropped:8

Re: [R] fitted values with locfit

2012-03-19 Thread Peter Ehlers
() or a matrix x to locfit.raw. Peter Ehlers Please, somebody knows how can I get the estimated fitted values of both smooth functions (m1) and (m2) using a local linear regression with kernel weights as this example? thanks a lot in advance I'm very desperate. Alexandra [[alternative HTML

Re: [R] by output into data frame

2012-03-19 Thread Peter Ehlers
amylase 2 604.90 2458.00 4 587.65 29954.55 6 493.60 13833.80 7 1211.00 4932.35 HTH, Jorge.- Or with the plyr package: library(plyr) ldply(auc_stress) Peter Ehlers On Mon, Mar 19, 2012 at 5:44 PM, David Perlman wrote: I could do this in various hacky ways, but what's the right way

Re: [R] rtriang using ifelse statement

2012-03-17 Thread Peter Ehlers
) when in fact it's still the whole matrix, presumably coerced to a vector. Thus rtriang() will be fed values of 'mode' that lie outside the interval [min, max] which I'm guessing causes the warning. Peter Ehlers sapply(matrx, function(x) if( x==1){rnorm(4)} else {rnorm(4)}) [,1

Re: [R] substituting own test statistics in a built-in function

2012-03-17 Thread Peter Ehlers
of mt.sample.rawp environment(myfun) - environment(mt.sample.rawp) Peter Ehlers On Thu, Mar 15, 2012 at 6:40 PM, Sarah Gosleesarah.gos...@gmail.comwrote: Hi, On Mar 15, 2012 4:28 AM, Aparna Sampathaparna.sampat...@gmail.com wrote: Hi All I would like to compute the raw p-value from permutation tests

Re: [R] Problem reading mixed CSV file

2012-03-16 Thread Peter Ehlers
() on your files before importing. Peter Ehlers On Fri, Mar 16, 2012 at 10:59 PM, David Winsemius dwinsem...@comcast.net wrote: On Mar 16, 2012, at 1:11 PM, Ashish Agarwal wrote: I want to import this CSV file into R. The CSV file is ,,,1968,21,0 ,,Boston,1968,13,0 ,,Boston,1968,18,0 ,,Chicago

Re: [R] Rolling regressions with sample extended one period at a time

2012-03-16 Thread Peter Ehlers
If the OP just wants the last fitted value, use fitted(): dats - data.frame(x = 1:100, y = rnorm(100)) num.runs - 21 fitvec - numeric(num.runs) for(i in seq_len(num.runs)){ fits - fitted(lm(y ~ x, data = dats[1:(80+i-1), ])) fitvec[i] - tail(fits, 1) } Peter Ehlers On 2012-03-16 14:05, R

Re: [R] max.print

2012-03-10 Thread Peter Ehlers
?integer) and I think that setting it to Inf is no longer legal (if ever it was). [Perhaps options() should generate a warning.] Peter Ehlers Syb [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] Aggregate with Function List ?

2012-03-05 Thread Peter Ehlers
..: FUN did not always return a scalar Suggestions? Are you using an old version of R (prior to 2.11.0)? Anyway, you might also check the plyr package's summarize() function. Or check out the data.table package. Peter Ehlers Regards, Michael -Original Message- From: David

Re: [R] Standard variance / devistion clarification

2012-03-01 Thread Peter Ehlers
xx- c(1, 1, 2, 10, 100, 10,1) boxplot(xx) For graphical analysis, I would prefer plot(xx, type=h). But most different as compared to the others is not well-defined. Possibly something like scale(xx) would help. Peter Ehlers After this it gets more complicated, but it you're new here let's take

Re: [R] puzzling results from logistic regression

2012-02-29 Thread Peter Ehlers
Michael (OP), Not that it's necessary, but you might also find confint(aa) to be instructive. Peter Ehlers On 2012-02-29 07:20, R. Michael Weylandt wrote: Formally, look at Pr(|z|). Informally, look at the null and residual deviances from print(aa). Michael On Wed, Feb 29, 2012 at 10:14 AM

Re: [R] linear regression by column

2012-02-29 Thread Peter Ehlers
: If response is a matrix a linear model is fitted separately by least-squares to each column of the matrix. Peter Ehlers But apparently it does not work. For about four or five reasons. . David Winsemius, MD West Hartford, CT __ R-help@r

Re: [R] Telling plot() the max y value to expect when plotting one distribution and then using lines() to add more distributions

2012-02-25 Thread Peter Ehlers
= PARAMETERS[i, color]) } I haven't followed this thread carefully so this may already have been suggested: can't you just replace the plot(), lines() calls with something like matplot(x,t(densities),type='l',lty=1,col=PARAMETERS$color, ylab = Density, main = SPX) ? Peter Ehlers

Re: [R] axis tick colors: only one value allowed?

2011-12-14 Thread Peter Ehlers
, 1:9, axes=FALSE, frame=TRUE) axis(1, at=c(1,4,7), col.ticks=2, lwd.ticks=2) axis(1, at=c(2,5,8), col.ticks=3, lwd.ticks=2) axis(1, at=c(3,6,9), col.ticks=4, lwd.ticks=2) Add col.axis=yourColourChoice arguments if you also want coloured labels. Peter Ehlers quote From: Hans W

Re: [R] Boxplot of multiple vectors with different lengths

2011-12-12 Thread Peter Ehlers
seeking a solution this way. I thought that Bert had given you the answer; try this: aa - runif(15) bb - rnorm(30) cc - rnorm(50,sd=2) z - c(aa,bb,cc) g - rep(LETTERS[1:3],c(length(aa),length(bb),length(cc))) boxplot(z ~ g) Peter Ehlers On Mon, Dec 12, 2011 at 4:09 PM, Vining

Re: [R] axis thickness in plot()

2011-12-06 Thread Peter Ehlers
(). Peter Ehlers Thank you for your kind help in advance, Alexandre -- View this message in context: http://r.789695.n4.nabble.com/axis-thickness-in-plot-tp4165430p4165430.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r

Re: [R] Plot and polygon in log scale

2011-12-02 Thread Peter Ehlers
to print appropriate axis labels. Peter Ehlers [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

Re: [R] legend, lheight, and alignment

2011-12-01 Thread Peter Ehlers
'. You might also avoid using 'paste' in your expressions; Try replacing expression(paste(Observed,italic(bar(EC)[e]))) with expression(Observed~italic(bar(EC)[e])) Peter Ehlers sessionInfo() R version 2.13.2 (2011-09-30) Platform: x86_64-pc-mingw32/x64 (64-bit) locale: [1] LC_COLLATE

Re: [R] Looking for a C function

2011-11-22 Thread Peter Ehlers
. Can somebody help me on where to find that? Try this: https://svn.r-project.org/R/trunk/src/library/stats/src/approx.c You'll find code for both approxtest and approxfun. Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] permutation within rows of a matrix

2011-11-16 Thread Peter Ehlers
I must be missing something. What's wrong with t(apply(mat, 1, sample)) ? Peter Ehlers On 2011-11-16 12:12, Gavin Simpson wrote: On Wed, 2011-11-16 at 14:29 -0500, R. Michael Weylandt wrote: Suppose your matrix is called X. ? sample X[sample(nrow(X)),] That will shuffle the rows

Re: [R] error while using shapiro.test()

2011-10-02 Thread Peter Ehlers
'. A worthwhile exercise might be to test several other distributions on your data. Peter Ehlers -- View this message in context: http://r.789695.n4.nabble.com/error-while-using-shapiro-test-tp3861535p3863205.html Sent from the R help mailing list archive at Nabble.com

Re: [R] Returning the name of an object passed directly or from a list by lapply

2011-09-16 Thread Peter Ehlers
intro to R text, has no help page I can find. grrr Look for 'dot-dot-dot' in the 'R Language Definition' manual (sec. 2.1.9). Peter Ehlers Your function is still not doing what I am trying to do, doubtless because I was not clear enough in the question I pose At the bottom of this message I have

Re: [R] If NA Problem!

2011-09-02 Thread Peter Ehlers
has given you one fix. Here's another (see ?'c'): iwish-list() for(p in seq_along(biglist)){ if(!is.na(lilwin[[p]])) iwish - c(iwish, biglist[[p]][lilwin[[p]]]) } BTW, it's not a good idea to use 'F' instead of FALSE and the negation operator is usually a better way to test. Peter

Re: [R] Gamma distribution parameter estimation

2011-08-07 Thread Peter Ehlers
of the error msg shows that the OP (without mentioning that salient fact) used a different set of values to fit. Peter Ehlers The salient issue is that the answers obtained by applying fitdistr() directly (without re-scaling) differ substantially from those obtained after rescaling. With only 20

Re: [R] cdplot error

2011-08-03 Thread Peter Ehlers
of 'An Introduction to R' likely would be profitable. Peter Ehlers Thanks. -- View this message in context: http://r.789695.n4.nabble.com/cdplot-error-tp3714454p3714454.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] Need to compute density as done by panel.histogram

2011-08-03 Thread Peter Ehlers
the code for the density rectangles in hist.default where 'counts' is computed and followed with dens - counts/(n * diff(breaks)) You might find the code for truehist() in the MASS package easy to follow. To see how hist.constructor calls hist(): lattice:::hist.constructor Peter Ehlers Any

Re: [R] lattice: index plot

2011-08-03 Thread Peter Ehlers
, subscripts){ x - seq_along(subscripts) panel.xyplot(x, y) } ) Peter Ehlers Thanks. KR, -Thorn __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org

Re: [R] gstat error

2011-08-03 Thread Peter Ehlers
(double, length) : invalid 'length' argument What's the problem? You should at the very least provide your sessionInfo(). Peter Ehlers Gilbert __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] lattice: index plot

2011-08-02 Thread Peter Ehlers
Does xyplot(y ~ seq_along(y), xlab = Index) do what you want? Peter Ehlers On 2011-08-02 09:07, Thaler, Thorn, LAUSANNE, Applied Mathematics wrote: Dear all, How can I make an index plot with lattice, that is plotting a vector simply against its particular index in the vector, i.e

Re: [R] Problems with ks.test()

2011-08-01 Thread Peter Ehlers
. Your results just show that this can be sensitive to the degree of rounding used for the theoretical cdf. Peter Ehlers On 2011-07-29 02:07, Jochen1980 wrote: Hi, I got two data point vectors. Now I want to make a ks.test(). I you print both vectors you will see, that they fit pretty fine. Here

Re: [R] Beta fit returns NaNs

2011-08-01 Thread Peter Ehlers
, and you might also set the optim method to BFGS (which, BTW, is the default in fitdistr()). library(fitdistrplus) fitdist(vectNorm, beta, start = list(shape1 = 2.15, shape2 = 810), optim.method = BFGS) Peter Ehlers -- View this message in context: http://r.789695.n4.nabble.com/Beta

Re: [R] axes label

2011-08-01 Thread Peter Ehlers
want the space. Peter Ehlers I will be glad for any help on how to label 10^-8 st km^-2day^-1 on the axis. Many thanks Regards Ogbos [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] Environment of a LM created in a function

2011-07-31 Thread Peter Ehlers
in inherits(x, data.frame) : object 'dta' not found But ?update tells us that we can provide additional or changed arguments to the call. So an easy fix is: update(models[[1]], . ~ ., data = dat) or update(models[[1]], . ~ ., data = model.frame(models[[1]])) Peter Ehlers However, if I try

Re: [R] Error in plotmath

2011-07-31 Thread Peter Ehlers
=expression(paste(Prob[, X= x, ]))) lines(ecdf(x), cex=.5) The problem also occurs if I use instead ylab=expression(prob(X= x))) Does the problem occur if you use ylab=expression(Prob[X = x])? Peter Ehlers All is well if I remove = but I need=. Frank - Frank Harrell Department

Re: [R] color of math annotation in legend

2011-07-28 Thread Peter Ehlers
On 2011-07-28 01:11, Zhongyi Yuan wrote: Thank you Tyler. I thought the problem was due to the use of expression(...). Also note that you can simplify your legend text: c(expression(alpha == 1), expression(alpha == 2)) In general, I find that paste() is overused in plotmath. Peter Ehlers

Re: [R] Fixed effects using Within transformation in PLM package

2011-07-28 Thread Peter Ehlers
doing any specific correction for the missing values? ?lm tells you what lm() is doing about missing values. I don't know what the plm [sic] package does. If you post a *minimal* example (*not* in HTML) showing the problem, you're likely to get someone to offer assistance. Peter Ehlers I really

Re: [R] color of error bars in Dotplot (Hmisc)

2011-07-27 Thread Peter Ehlers
$site), lwd = 2)), panel = mypanel.Dotplot) where mypanel.Dotplot() is panel.Dotplot() with the modified line as indicated above. Peter Ehlers You might be able to get customized results with panel.arrow. Dieter -- View this message in context: http://r.789695.n4.nabble.com/color

Re: [R] Rescaling columns in a multi-plot layout

2011-07-26 Thread Peter Ehlers
three rows, whereas I would like to rescale that of only row #1. Is there a simple way of doing this? I think that you'll have to make 3 columns: layout(matrix(c(1,1,2,3,4,4,5,6,6), 3, 3, byrow = TRUE), widths = c(3.5, 1.5, 2)) layout.show(6) Peter Ehlers Thanks, Manojit

Re: [R] a question about glht function

2011-07-26 Thread Peter Ehlers
, linfct = mcp(f_GROUP=Tukey) ) Error in `[.data.frame`(mf, nhypo[checknm]) : undefined columns selected I can't find out the reason for Error. I think glht() is looking for f_GROUP in data_ori. You have defined f_GROUP in your global environment but have not added it to your dataframe. Peter

Re: [R] a question about glht function

2011-07-26 Thread Peter Ehlers
, random = ~ time | ID, data = data_ori) glht(result, linfct = mcp(f_GROUP = Tukey)) #Error in `[.data.frame`(mf, nhypo[checknm]) : undefined columns # selected (Note that I changed data_ori$f_GROUP to data_ori$GROUP.) Peter Ehlers Any help from you are welcome. Many thanks

Re: [R] Lattice: choice of symbol and symbol position in legend

2011-07-26 Thread Peter Ehlers
= .8, corner = c(0, 0), points = list(pch=22, col=c(2,4,3), cex=1.5), text = list(levels(iris$Species ?xyplot gives a number of other key() parameters that can be adjusted. Peter Ehlers -- View this message in context: http://r.789695.n4.nabble.com/Lattice-choice

Re: [R] Lattice: distance of tick labels from axis line

2011-07-25 Thread Peter Ehlers
( axis.components=list( left=list(pad1=0.5 Peter Ehlers -- View this message in context: http://r.789695.n4.nabble.com/Lattice-distance-of-tick-labels-from-axis-line-tp3693014p3693014.html Sent from the R help mailing list archive at Nabble.com

Re: [R] Finding/identifying a value within a factor

2011-07-25 Thread Peter Ehlers
with. Peter Ehlers HTH, Denes Hi all, I'm trying to identify a particular digit or value within a vector of factors. Specifically, this is environmental data where in some cases the minimum value reported is a particular number (and I want to manipulate only these). For example: x-c

Re: [R] Standardizing the number of records by group

2011-07-25 Thread Peter Ehlers
the records after 4? Can anyone suggest a good way to do this? Just subset in your function definition: mean(df$x) -- mean(df$x[1:4]) But I would use summarize: ddply(df, .(fac), summarize, x.avg = mean(x[1:4]), n = length(x)) Peter Ehlers I am using R 2.12.1 and Emacs + ESS. Thanks so much

Re: [R] Recoding Multiple Variables in a Data Frame in One Step

2011-07-25 Thread Peter Ehlers
18 9 0.4121185 Maine19 10 -0.5440211 JUNK -99 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com Here's another solution, using within(): within(df, {Name[Size0] - 'JUNK' Value[Size0] - -99}) But I like William's simple list() solution. Peter Ehlers

Re: [R] split data frame temporary and work with only part of it?

2011-07-24 Thread Peter Ehlers
(20)) idx - which(dat$y 17) dat2 - data.frame(x=c(999,-889,777), y=c(-44,NA,0)) dat[idx, ] - dat2 dat Peter Ehlers sincerely, /iaw Ivo Welch (ivo.we...@gmail.com) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] cv.glm and longer object length is not a multiple of shorter object length error

2011-07-22 Thread Peter Ehlers
(..., na.action = na.exclude) but cv.glm() appears not (yet) to be coded to handle padding of missing values. Peter Ehlers -- View this message in context: http://r.789695.n4.nabble.com/cv-glm-and-longer-object-length-is-not-a-multiple-of-shorter-object-length-error-tp3685622p3685622.html Sent from

Re: [R] Lattice: place ticks only on y-axis

2011-07-22 Thread Peter Ehlers
= FALSE)), ...) Peter Ehlers is what you want. -- Bert On Fri, Jul 22, 2011 at 6:07 AM, marcelmarcelcur...@gmail.com wrote: I notice that with this solution there are still y-axis tick marks on both sides of the plot. Is there a way to remove the ones on the right side? -- View this message

Re: [R] Lattice: distance of Y-axis label from plot

2011-07-22 Thread Peter Ehlers
a par.settings argument to your plot definition: xyplot(..., par.settings = list( layout.widths = list(ylab.axis.padding = 0.5))) Peter Ehlers -- View this message in context: http://r.789695.n4.nabble.com/Lattice-distance-of-Y-axis-label-from-plot-tp3686855p3686855.html Sent from

Re: [R] Latex Table Help on R

2011-07-21 Thread Peter Ehlers
,) # note 1,2,3 spaces to make rownames unique mat.tb - xtable(mat, align=c(r,c,c)) mat.tb Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org

Re: [R] replacing duplicate rows

2011-07-21 Thread Peter Ehlers
to replace x[3,2] by x[2,2]. Similarly, I want to replace x[5,2] with x[4,2], which means that for duplicate entries in the 1st column, I want to replace the corresponding entries in the 2nd column with its 1st entry of the duplicate row. Try match(): idx - match(x[,1], x[,1]) x[,2] - x[idx,2] Peter

Re: [R] Lattice: place ticks only on y-axis

2011-07-21 Thread Peter Ehlers
(plot1, position=c(0,0,1,.6)) Maybe just: xyplot(, scales = list(x = list(draw = FALSE)), ) Peter Ehlers -- View this message in context: http://r.789695.n4.nabble.com/Lattice-place-ticks-only-on-y-axis-tp3684094p3684094.html Sent from the R help mailing list archive at Nabble.com

Re: [R] read.csv help

2011-07-19 Thread Peter Ehlers
. Peter Ehlers -- View this message in context: http://r.789695.n4.nabble.com/read-csv-help-tp3677454p3677586.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] nls() and lines()

2011-07-18 Thread Peter Ehlers
() often. This 'exact' code worked in the past? Peter Ehlers The model is fine, but it's the plotting of the model that escapes me. I'm running R version 2.12.1 on a Windows 7 machine. Thanks for your help - Steven H. Ranney http://stevenranney.blogspost.com http://www.steven-ranney.com

<    1   2   3   4   5   6   7   8   9   10   >