Stephen Nyangoma
2004-Aug-27 17:18 UTC
[R] selecting unique columns of a matrix/data frame
Hi all, I have a very high dimensional data and apparently there are several columns that contain similar information (some columns are equal). I want to form a matrix/data frame consisting of unique columns. Does anyone have an efficient way of getting out these columns. A small section of the data frame is given below. Thanks for helping. Stephen.> newdata[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 107 125 149 149 165 125 172 172 149 149 107 125 [2,] 185 171 150 150 299 171 173 173 150 150 185 171 [3,] 0 193 177 177 618 193 343 343 177 177 0 193 [4,] 0 0 178 178 0 0 365 0 178 178 0 0 [5,] 0 0 223 223 0 0 0 0 223 223 0 0 [6,] 0 0 245 245 0 0 0 0 245 245 0 0 [7,] 0 0 246 246 0 0 0 0 246 246 0 0 [8,] 0 0 466 466 0 0 0 0 466 466 0 0 [9,] 0 0 467 467 0 0 0 0 467 467 0 0 [10,] 0 0 468 468 0 0 0 0 468 0 0 0 ##################################################################################> > Easy! > > > > Mathematical conventions are just that, conventions. They > > differ by field > > of mathematics. Don't ask us why matrix rows are numbered > > down but graphs > > are numbered up the y axis, nor why x comes before y but row before > > column. But the matrix layout has always seemed illogical to me. > > My 30+ years of software experience says this is a design flaw. A good > design would reconcile the differences between conventions. Coordinate > transformations are not that hard, but I wouldn't burden the end-user > with them needlessly. > > I'll go back to lurking in the daily R-Helps and not ask any more > questions until I've read all the old R-help messages. I'm working on > December 1998 right now and reading forward. Perhaps by next year I'll > will have read all the old R-help postings and I'll dare ask another > question then. > > efg > > > > ------------------------------ > > Message: 72 > Date: Thu, 26 Aug 2004 23:04:10 +0100 > From: "Jennie Bee" <jnb21 at cam.ac.uk> > Subject: [R] AIC to compare glm models with Poisson errors? > To: <r-help at stat.math.ethz.ch> > Message-ID: <025301c48bb8$9d5d3070$07256f83 at plantsci.cam.ac.uk> > Content-Type: text/plain > > > I have used the glm function to fit a series of models using a poisson error structure. > e.g: > Model 1: Y is a function of a + bX > Model 2: Y is a function of a > > I have tried to compare models using AIC, but do not get sensible results (lower AICs for the null, intercept only, model despite the alternate model containing highly significant parameters). > > > > I found the following explanation in the online R manual, that seemed to be relevant: > > "There is a potential problem in using glm fits with a variable scale, as in that case the deviance is not simply related to the maximized log-likelihood. The "glm" method for function extractAIC makes the appropriate adjustment for a gaussian family, but may need to be amended for other cases. (The binomial and poisson families have fixed scale by default and do not correspond to a particular maximum-likelihood problem for variable scale.) " > > My question is, how do you amend the function for the poisson family? > Should I be using AIC, or is there a better information criterion? - I want a method that has the flexibility to compare alternative models that (unlike in my example) are not simply nested families of additive variables. > > Many thanks, > Jennie Bee > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Jennie Bee > > Conservation and Community Ecology Group > Department of Plant Sciences > University of Cambridge > Downing Street > Cambridge > CB2 3EA > > Tel: +44 (0)1223 330213 (office); 07890 971 374 (mobile) > [[alternative HTML version deleted]] > > > > ------------------------------ > > Message: 73 > Date: Fri, 27 Aug 2004 10:10:20 +1200 (NZST) > From: David Scott <d.scott at auckland.ac.nz> > Subject: Re: [R] Plotting groupedData objects > To: Deepayan Sarkar <deepayan at cs.wisc.edu> > Cc: r-help at stat.math.ethz.ch > Message-ID: > <Pine.LNX.4.44.0408271003320.31281-100000 at hydra.stat.auckland.ac.nz> > Content-Type: TEXT/PLAIN; charset=US-ASCII > > On Thu, 26 Aug 2004, Deepayan Sarkar wrote: > > > Quoting David Scott <d.scott at auckland.ac.nz>: > > > > > > > > I am trying to create a plot similar to Figure 3.2 in Bates and Pinheiro. > > > > > > I have repeated measurements on about 80 subjects from 2 treatment groups. > > > I would like to have the panels for the two treatment groups in separate > > > groups and within those groups have the panels ordered on maximum value > > > (as is the default). > > > > > > I am ok with getting plots similar to Figs 3.1 and 3.2, but can't see how > > > to change the ordering of the panels to what I want. > > > > > > Here is the definition of my groupedData object > > > > > > RAWlmeData <- groupedData(RAW~Elapsed|ID, > > > data=RAWData, > > > labels=list(x="Elapsed time",y="Airways resistance"), > > > units=list(x="(hours)",y="cm H20/L/sec")) > > > > > > I guess I could just plot the two treatment groups separately in turn but > > > I feel there is something I am missing. > > > > My reading of page 105 suggests that you need to specify > > 'outer=<whatever your grouping factor is>'. > > Have you tried that? > > > I did try that. It produces Fig 3.3 with multiple lines giving the results > for each subject by treatment. With around 40 subjects per treatment > group, that isn't very attractive in my case. > > I should also mention that I looked for on-line complements to Pinheiro > and Bates, and found MEMSS.tar.gz on > http://cm.bell-labs.com/cm/ms/departments/sia/NLME/MEMSS/index.html > which promised scripts for the examples in the book but turned out to have > only chapters 1 and 2, and for S-PLUS rather than R (going on the .q > extension). > > David Scott > > _________________________________________________________________ > David Scott Department of Statistics, Tamaki Campus > The University of Auckland, PB 92019 > Auckland NEW ZEALAND > Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000 > Email: d.scott at auckland.ac.nz > > > Graduate Officer, Department of Statistics > > > > ------------------------------ > > Message: 74 > Date: Thu, 26 Aug 2004 15:11:36 -0700 > From: Johannes Graumann <graumann at its.caltech.edu> > Subject: Re: [R] how to make lines() meet axis in autoscaled > coordinate system? > To: Rolf Turner <rolf at math.unb.ca> > Cc: r-help at stat.math.ethz.ch > Message-ID: <20040826151136.15e13b5c at localhost> > Content-Type: text/plain; charset=US-ASCII > > Grand! > > Thanks so much! > > Joh > > On Thu, 26 Aug 2004 18:15:44 -0300 (ADT) > Rolf Turner <rolf at math.unb.ca> wrote: > > > > > Johannes Graumann wrote: > > > > > I have an auto-scaled coordinate system and would like to add some > > > clarifying lines to the graph - which ares supposed to meet the > > > axis. > > > > > > >lines(c(0,time1,time1), c(1,1,0),lty=3) > > > > > > does what I want, BUT the second leg does not touch the x-axis since > > > the auto-scaling of the y-axis does not start at'0' but slightly > > > negative. I could now adjust the line length by 'trial and error' to > > > suit my needs, but I'd prefer a generalizable solution like > > > > > > >lines(c(<some_macro_for_y-axis_position>,time1,time1), > > > + c(1,1,<some_macro_for_x-axis_position>),lty=3) > > > > lines(c(par()$usr[1],time1,time1), c(1,1,par()$usr[3]),lty=3) > > > > cheers, > > > > Rolf Turner > > rolf at math.unb.ca > > > > > > ------------------------------ > > Message: 75 > Date: Thu, 26 Aug 2004 17:14:01 -0500 > From: Douglas Bates <bates at stat.wisc.edu> > Subject: Re: [R] GLMM > To: "Bossarte, Robert" <bvy9 at cdc.gov> > Cc: r-help at stat.math.ethz.ch > Message-ID: <412E60A9.1070808 at stat.wisc.edu> > Content-Type: text/plain; charset=us-ascii; format=flowed > > Bossarte, Robert wrote: > > I am trying to use the LME package to run a multilevel logistic model > > using the following code: > > > > > > > > ------------------------------------------------------------------------ > > ------------------------------------------- > > > > > > > > Model1 = GLMM(WEAP ~ TSRAT2 , random = ~1 | GROUP , family = binomial, > > na.action = na.omit ) > > > > > > > > ------------------------------------------------------------------------ > > ------------------------------------------- > > > > > > > > Where WEAP is a dichotomous outcome measure, TSRAT2 is a group level > > covariate, and GROUP is the grouping variable. > > > > > > > > I do not have significant missing data and the dataset is over 15000 > > cases. > > > > > > > > I have tried changing the outcome measure(s) and predictor(s) with the > > same result. Each time R fails and returns the following message: > > > > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------ > > > > > > > > structure(list( : flist must be a non-empty list of factors > > > > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------ > > > > > > > > This appears to be problem with the grouping variable, yet there are no > > missing values and the data were sorted on this variable prior to being > > read into R. > > Is the grouping variable a factor? Check with > > str(GROUP) > > If it isn't a factor then convert it a factor using > > GROUP <- factor(GROUP) > > > > > > > > > Any suggestions would be greatly appreciated. > > > > ------------------------------ > > Message: 76 > Date: Thu, 26 Aug 2004 17:17:24 -0500 (CDT) > From: "John Pitney" <john at pitney.org> > Subject: Re: [R] Why terms are dropping out of an lm() model > To: sundar.dorai-raj at PDF.COM > Cc: r-help at stat.math.ethz.ch > Message-ID: <14541.167.170.98.10.1093558644.squirrel at www.pitney.org> > Content-Type: text/plain;charset=iso-8859-1 > > > > > > > John Pitney wrote: > >> Hi all! > >> > >> I'm fairly new to R and not too experienced with regression. Because > >> of one or both of those traits, I'm not seeing why some terms are being > >> dropped from my model when doing a regression using lm(). > >> > >> I am trying to do a regression on some experimental data d, which has > >> two numeric predictors, p1 and p2, and one numeric response, r. The aim > >> is to compare polynomial models in p1 and p2 up to third order. I don't > >> understand why lm() doesn't return coefficients for the p1^3 and p2^3 > >> terms. Similar loss of terms happened when I tried orthonormal > >> polynomials to third order. > >> > >> I'm satisfied with the second-order regression, by the way, but I'd > >> still like to understand why the third-order regression doesn't work > >> like I'd expect. > >> > >> Can anyone offer a pointer to help me understand this? > >> > >> Here's what I'm seeing in R 1.9.1 for Windows. Note the NA's for p1^3 > >> and p2^3 in the last summary. > >> > >> [stuff deleted] > >> > >> -0.089823 -0.017707 0.001952 0.020820 0.059302 > >> > >> Coefficients: (2 not defined because of singularities) > > > > Did you miss reading the above line? Seems you supplied a singular model > > to `lm' and since the default for `lm' is `singular.ok = TRUE,' it just > > pivoted these columns out in the QR-decomposition. > > Yes, I missed that line. The model matrix is indeed singular. > > Thanks for the quick and helpful response, and sorry for posting before > thinking carefully enough! > > John > > > > ------------------------------ > > Message: 77 > Date: Thu, 26 Aug 2004 17:22:41 -0500 > From: Deepayan Sarkar <deepayan at cs.wisc.edu> > Subject: Re: [R] Plotting groupedData objects > To: David Scott <d.scott at auckland.ac.nz> > Cc: r-help at stat.math.ethz.ch > Message-ID: <1093558961.412e62b1c674e at www-auth.cs.wisc.edu> > Content-Type: text/plain; charset=utf-8 > > Quoting David Scott <d.scott at auckland.ac.nz>: > > > On Thu, 26 Aug 2004, Deepayan Sarkar wrote: > > > > > Quoting David Scott <d.scott at auckland.ac.nz>: > > > > > > > > > > > I am trying to create a plot similar to Figure 3.2 in Bates and > > Pinheiro. > > > > > > > > I have repeated measurements on about 80 subjects from 2 treatment > > groups. > > > > I would like to have the panels for the two treatment groups in separate > > > > groups and within those groups have the panels ordered on maximum value > > > > (as is the default). > > > > > > > > I am ok with getting plots similar to Figs 3.1 and 3.2, but can't see how > > > > > > to change the ordering of the panels to what I want. > > > > > > > > Here is the definition of my groupedData object > > > > > > > > RAWlmeData <- groupedData(RAW~Elapsed|ID, > > > > data=RAWData, > > > > labels=list(x="Elapsed time",y="Airways resistance"), > > > > units=list(x="(hours)",y="cm H20/L/sec")) > > > > > > > > I guess I could just plot the two treatment groups separately in turn but > > > > > > I feel there is something I am missing. > > > > > > My reading of page 105 suggests that you need to specify > > > 'outer=<whatever your grouping factor is>'. > > > Have you tried that? > > > > > I did try that. It produces Fig 3.3 with multiple lines giving the results > > for each subject by treatment. With around 40 subjects per treatment > > group, that isn't very attractive in my case. > > I should have been more specific, but I thought this was clear enough in the > book. I was talking about specifying outer in the groupedData() constructor, > not in the plot() call. Have you tried _that_? > > > I should also mention that I looked for on-line complements to Pinheiro > > and Bates, and found MEMSS.tar.gz on > > http://cm.bell-labs.com/cm/ms/departments/sia/NLME/MEMSS/index.html > > which promised scripts for the examples in the book but turned out to have > > only chapters 1 and 2, and for S-PLUS rather than R (going on the .q > > extension). > > The R scripts are, naturally enough, bundled with the R version of the package. > They should be in the scripts/ subdirectory of your nlme installation. > > Deepayan > > > > ------------------------------ > > Message: 78 > Date: Thu, 26 Aug 2004 17:36:00 -0500 > From: Deepayan Sarkar <deepayan at cs.wisc.edu> > Subject: RE: [R] Surprise when mapping matrix to image > To: "Glynn, Earl" <EFG at Stowers-Institute.org> > Cc: Prof Brian Ripley <ripley at stats.ox.ac.uk>, > r-help at stat.math.ethz.ch > Message-ID: <1093559760.412e65d0a85ee at www-auth.cs.wisc.edu> > Content-Type: text/plain; charset=utf-8 > > Quoting "Glynn, Earl" <EFG at Stowers-Institute.org>: > > > Prof Ripley: > > > > Thank you for your prompt reply. > > > > > It's pure convention: see below. > > > > > > Did you try reading the help for image? You don't seem to > > > understand it > > > if you actually did. It seems you are looking for > > > > > > image(t(x)[ncol(x):1, ]) > > > > I think you guys are too close to "R" to understand how hard it is to > > use sometimes. What may be blatantly obvious to you is quite a problem > > especially to beginners. Some of us may be beginners to R, but we know > > math, science, programming, and how to solve problems with other tools > > and languages. > > > > I re-read the guidelines before posting fearing condemnation. > > > > Before posting I searched the online R-help Google interface with > > keywords "image", "flip", "rotate". A discussion from 1998 touched on > > this issue but I was hoping that this was deemed a "bug" at some point > > and fixed -- or had an easy workaround, like some parameter I was > > missing. > > > > I read the "?image" help before posting. Was the part I didn't > > understand buried in this "note"? > > > > "Based on a function by Thomas Lumley tlumley at u.washington.edu." > > You seem to be thinking that Prof Ripley's solution had something to do with > image(). It doesn't, it has to do with manipulating a matrix. image() > visualizes a matrix in a particular and well-defined way. You want your matrix > to be shown in a different way, and one (simple) way of doing that is to > convert your matrix into a different matrix, on which calling image would give > you what you want. Why would this be explained in ?image ? This is basic R. > > More generally, I think your frustration is caused by your expectation that a > matrix object should behave like a bitmap image. It doesn't. If you want work > with images, use the pixmap package. > > Deepayan > > > > ------------------------------ > > Message: 79 > Date: Thu, 26 Aug 2004 15:50:43 -0700 > From: "T. Murlidharan Nair" <nair at sdsc.edu> > Subject: [R] Error TukeyHSD > To: r-help at stat.math.ethz.ch > Message-ID: <412E6943.6020307 at sdsc.edu> > Content-Type: text/plain; charset=us-ascii; format=flowed > > I am running the following code on the coagulation data and I am getting > an error. Please let me know > if I am missing anything from my code. > > coag<- matrix( scan("//Samba3/nair/R/blood.dat", sep=","), 24, 3, > byrow=TRUE) > colnames(coag) <- c("time","diet","order") > coag <- as.data.frame(coag) > oneway.test(time ~ diet, data=coag, var.eq=TRUE) > coag.mod <- aov(time ~ diet, data=coag) > options(scipen=5) > options(digits=5) > TukeyHSD( coag.mod ) > > > I get the following error when I run the above code > Read 72 items > Error in rep.int(n, length(means)) : Unimplemented feature in rep > In addition: Warning message: > non-factors ignored: diet in: replications(paste("~", > paste(names(tables), collapse = "+")), > > The data is here .. > > 62,1,20 > 60,1,2 > 63,1,11 > 59,1,10 > 63,2,12 > 67,2,9 > 71,2,15 > 64,2,14 > 65,2,4 > 66,2,8 > 68,3,16 > 66,3,7 > 71,3,1 > 67,3,17 > 68,3,13 > 68,3,21 > 56,4,23 > 62,4,3 > 60,4,6 > 61,4,18 > 63,4,22 > 64,4,19 > 63,4,5 > 59,4,24 > > > Thanks ../ Murli > > > > ------------------------------ > > Message: 80 > Date: Thu, 26 Aug 2004 18:08:47 -0500 > From: "Mihai Nica" <m_nica at hotmail.com> > Subject: [R] coplot and par > To: r-help at stat.math.ethz.ch > Message-ID: <BAY18-F11XCpU6q5ijb0001c543 at hotmail.com> > Content-Type: text/plain; format=flowed > > R 1.9.1 on Win2000 or Win98SE. > > I am using coplot as follows: > > coplot(AVG~LRPI| REGION) > > the output seems normal but I get: > > "Warning message: > calling par(new=) with no plot" > > This is the only explanation that I have for being unable to use par() with > coplot for changing the way the xlab and ylab appears. From within coplot I > can change the text itself but not the font, fontsize, etc, but par() before > coplot has absolutely no effect wahtsoever (maybe it isn't supposed to?). > > I guess the question is: how can one change the way the xlab and ylab appear > on a coplot? > > Thanks, > > Mihai > JSU > > > > ------------------------------ > > Message: 81 > Date: Thu, 26 Aug 2004 16:11:04 -0700 > From: rossini at blindglobe.net (A.J. Rossini) > Subject: Re: [R] Surprise when mapping matrix to image > To: r-help at stat.math.ethz.ch > Message-ID: <85k6vlebqv.fsf at servant.blindglobe.net> > Content-Type: text/plain; charset=us-ascii > > > I think I'd have to respectfully disagree with both Brian and > Deepayan, as to whether it should be obvious. It is reasonable > (principle of least suprise) to expect orientation of the plot to > match the print order of the matrix. I would have expected Brian's > one-liner to be in the help page, with a notice. It's a not-so-rare > activity, being a general matrix visualization that is commonly used > in certain areas of science (whether it ought to be commonly used is a > separate question). > > While "heatmap" might've been perhaps a better pointer, but it doesn't > seem to do the "right" thing, either. I.e. > > myTemp <- matrix(c(1,2,3,3,2,3),nrow=2) > heatmap(myTemp,Rowv=NA,Colv=NA) > > doesn't look right to me (R Version 1.9.1 (2004-06-21)) > > I see the "pixmap/bitmap" issue as a bit of a red herring, in this > case. > > best, > -tony > > p.s. I seem to get bit by this about once a year for the last few, > hence why I'm speaking up. > > > > > > > > > Deepayan Sarkar <deepayan at cs.wisc.edu> writes: > > > Quoting "Glynn, Earl" <EFG at Stowers-Institute.org>: > > > >> Prof Ripley: > >> > >> Thank you for your prompt reply. > >> > >> > It's pure convention: see below. > >> > > >> > Did you try reading the help for image? You don't seem to > >> > understand it > >> > if you actually did. It seems you are looking for > >> > > >> > image(t(x)[ncol(x):1, ]) > >> > >> I think you guys are too close to "R" to understand how hard it is to > >> use sometimes. What may be blatantly obvious to you is quite a problem > >> especially to beginners. Some of us may be beginners to R, but we know > >> math, science, programming, and how to solve problems with other tools > >> and languages. > >> > >> I re-read the guidelines before posting fearing condemnation. > >> > >> Before posting I searched the online R-help Google interface with > >> keywords "image", "flip", "rotate". A discussion from 1998 touched on > >> this issue but I was hoping that this was deemed a "bug" at some point > >> and fixed -- or had an easy workaround, like some parameter I was > >> missing. > >> > >> I read the "?image" help before posting. Was the part I didn't > >> understand buried in this "note"? > >> > >> "Based on a function by Thomas Lumley tlumley at u.washington.edu." > > > > You seem to be thinking that Prof Ripley's solution had something to do with > > image(). It doesn't, it has to do with manipulating a matrix. image() > > visualizes a matrix in a particular and well-defined way. You want your matrix > > to be shown in a different way, and one (simple) way of doing that is to > > convert your matrix into a different matrix, on which calling image would give > > you what you want. Why would this be explained in ?image ? This is basic R. > > > > More generally, I think your frustration is caused by your expectation that a > > matrix object should behave like a bitmap image. It doesn't. If you want work > > with images, use the pixmap package. > > > > Deepayan > > > > ______________________________________________ > > R-help at 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 > > > > -- > Anthony Rossini Research Associate Professor > rossini at u.washington.edu http://www.analytics.washington.edu/ > Biomedical and Health Informatics University of Washington > Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center > UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable > FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email > > CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} > > > > ------------------------------ > > Message: 82 > Date: Thu, 26 Aug 2004 16:29:40 -0700 > From: Johannes Graumann <graumann at its.caltech.edu> > Subject: [R] text() with text, variables and math HOWTO? > To: r-help at stat.math.ethz.ch > Message-ID: <20040826162940.5ef5149d at localhost> > Content-Type: text/plain; charset=US-ASCII > > Hello, > > One more question from the 'abusing R for blotting - particularly > anally' department: > How can I in the expression below make the '%~~%' show up as the > aprrox-sign I want it to be? > > Thanks for any hint, > > Joh > > text( > 500,1.5, > cex=0.75, > substitute( > paste( > OD[600][~nm], > " of 1 at ", > time1, > " min ", > "%~~%", > time1h, > "h" > ), > list( > time1=round(time1,digits=0), > time1h=round(time1/60,digits=1) > ) > ) > ) > > > > ------------------------------ > > Message: 83 > Date: Thu, 26 Aug 2004 16:13:19 -0700 (PDT) > From: franc Li <avelox12 at yahoo.com> > Subject: [R] multiple regression with dummy variables > To: r-help at stat.math.ethz.ch > Message-ID: <20040826231319.9247.qmail at web51810.mail.yahoo.com> > Content-Type: text/plain; charset=us-ascii > > Hi I'm a beginner in R, please help... > > I'm trying to do regression analysis on a categorical > data to find b's of each Xi. Essentially, f(x) is the > output, and two independent variables Xd (days of week > (1,2,...,7) and Xwk (week of month > (1,2,...,6)including partial wks). > > So the data looks like this: > f(x) Xd Xwk > 0.03 1 2 > 0.06 3 1 > : > : > > I use factor() and contrasts() to produce I.matrix as > such > 2 3 4 5 6 7 > 1 0 0 0 0 0 0 > 2 1 0 0 0 0 0 > 3 0 1 0 0 0 0 > 4 0 0 1 0 0 0 > 5 0 0 0 1 0 0 > 6 0 0 0 0 1 0 > 7 0 0 0 0 0 1 > > 2 3 4 5 6 > 1 0 0 0 0 0 > 2 1 0 0 0 0 > 3 0 1 0 0 0 > 4 0 0 1 0 0 > 5 0 0 0 1 0 > 6 0 0 0 0 1 > > However, when I tried to regress with: > > summary(lm(log(y1)~ I(daydum==1) + I(weekdum==1)), > contrast=T) > > Error in model.frame(formula, rownames, variables, > varnames, extras, extranames, : > variable lengths differ > > I'm trying to find pairwise regression in order to > find each bi. Can anyone hlep? Thanks so much in > advance. > > franc > > > > ------------------------------ > > Message: 84 > Date: Thu, 26 Aug 2004 19:42:35 -0400 > From: "Jim Brennan" <jfbrennan at rogers.com> > Subject: Re: [R] Surprise when mapping matrix to image > To: <rossini at u.washington.edu>, <r-help at stat.math.ethz.ch> > Message-ID: > <014201c48bc6$5e03a860$3b8ac445 at slnt.phub.net.cable.rogers.com> > Content-Type: text/plain; charset="iso-8859-1" > > I was also surprised by the image orientation this summer and used the > "easy" fix of matrix manipulation. There is however another issue and that > is when you start flipping around the matrix, orders etc. and for the case > you want to have sensibly labeled axes, you may have to use the axis > commands etc. which is also easy, but accumulation of easy fixes can be > tedious so there is perhaps some argument for yet another new documentation > submission. Maybe a method for easily changing the orientation in image > could be added. > > Jim > ----- Original Message ----- > From: "A.J. Rossini" <rossini at blindglobe.net> > To: <r-help at stat.math.ethz.ch> > Sent: Thursday, August 26, 2004 7:11 PM > Subject: Re: [R] Surprise when mapping matrix to image > > > > > > I think I'd have to respectfully disagree with both Brian and > > Deepayan, as to whether it should be obvious. It is reasonable > > (principle of least suprise) to expect orientation of the plot to > > match the print order of the matrix. I would have expected Brian's > > one-liner to be in the help page, with a notice. It's a not-so-rare > > activity, being a general matrix visualization that is commonly used > > in certain areas of science (whether it ought to be commonly used is a > > separate question). > > > > While "heatmap" might've been perhaps a better pointer, but it doesn't > > seem to do the "right" thing, either. I.e. > > > > myTemp <- matrix(c(1,2,3,3,2,3),nrow=2) > > heatmap(myTemp,Rowv=NA,Colv=NA) > > > > doesn't look right to me (R Version 1.9.1 (2004-06-21)) > > > > I see the "pixmap/bitmap" issue as a bit of a red herring, in this > > case. > > > > best, > > -tony > > > > p.s. I seem to get bit by this about once a year for the last few, > > hence why I'm speaking up. > > > > > > > > > > > > > > > > > > Deepayan Sarkar <deepayan at cs.wisc.edu> writes: > > > > > Quoting "Glynn, Earl" <EFG at Stowers-Institute.org>: > > > > > >> Prof Ripley: > > >> > > >> Thank you for your prompt reply. > > >> > > >> > It's pure convention: see below. > > >> > > > >> > Did you try reading the help for image? You don't seem to > > >> > understand it > > >> > if you actually did. It seems you are looking for > > >> > > > >> > image(t(x)[ncol(x):1, ]) > > >> > > >> I think you guys are too close to "R" to understand how hard it is to > > >> use sometimes. What may be blatantly obvious to you is quite a problem > > >> especially to beginners. Some of us may be beginners to R, but we know > > >> math, science, programming, and how to solve problems with other tools > > >> and languages. > > >> > > >> I re-read the guidelines before posting fearing condemnation. > > >> > > >> Before posting I searched the online R-help Google interface with > > >> keywords "image", "flip", "rotate". A discussion from 1998 touched on > > >> this issue but I was hoping that this was deemed a "bug" at some point > > >> and fixed -- or had an easy workaround, like some parameter I was > > >> missing. > > >> > > >> I read the "?image" help before posting. Was the part I didn't > > >> understand buried in this "note"? > > >> > > >> "Based on a function by Thomas Lumley tlumley at u.washington.edu." > > > > > > You seem to be thinking that Prof Ripley's solution had something to do > with > > > image(). It doesn't, it has to do with manipulating a matrix. image() > > > visualizes a matrix in a particular and well-defined way. You want your > matrix > > > to be shown in a different way, and one (simple) way of doing that is to > > > convert your matrix into a different matrix, on which calling image > would give > > > you what you want. Why would this be explained in ?image ? This is basic > R. > > > > > > More generally, I think your frustration is caused by your expectation > that a > > > matrix object should behave like a bitmap image. It doesn't. If you want > work > > > with images, use the pixmap package. > > > > > > Deepayan > > > > > > ______________________________________________ > > > R-help at 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 > > > > > > > -- > > Anthony Rossini Research Associate Professor > > rossini at u.washington.edu http://www.analytics.washington.edu/ > > Biomedical and Health Informatics University of Washington > > Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center > > UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable > > FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email > > > > CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} > > > > ______________________________________________ > > R-help at 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 > > > > ------------------------------ > > Message: 85 > Date: Thu, 26 Aug 2004 18:55:28 -0500 > From: Erin Hodgess <hodgess at gator.uhd.edu> > Subject: [R] expressions/approximate text > To: r-help at stat.math.ethz.ch > Message-ID: <200408262355.i7QNtSh18436 at gator.dt.uh.edu> > > Please forgive the general posting. > > To get the x approximately = y, > please try > text(6,2,expression(x %~~% y)) > > HTH. > > Sincerely, > Erin Hodgess > mailto: hodgess at gator.uhd.edu > > > > ------------------------------ > > Message: 86 > Date: Fri, 27 Aug 2004 12:05:26 +1200 > From: Paul Murrell <p.murrell at auckland.ac.nz> > Subject: Re: [R] Label using equivalent of \mathbb{R} > To: Deepayan Sarkar <deepayan at stat.wisc.edu> > Cc: r-help at stat.math.ethz.ch, Martin Maechler > <maechler at stat.math.ethz.ch> > Message-ID: <412E7AC6.3060807 at stat.auckland.ac.nz> > Content-Type: text/plain; charset=us-ascii; format=flowed > > Hi > > > Deepayan Sarkar wrote: > > On Thursday 26 August 2004 11:41, Martin Maechler wrote: > > > >>>>>>>"Simon" == Simon Cullen <cullens at tcd.ie> > >>>>>>> on Thu, 26 Aug 2004 15:30:06 +0100 writes: > >>>>>> > >> Simon> On Thu, 26 Aug 2004 15:24:33 +0200, Trenkler, > >> Simon> Dietrich <dtrenkler at nts6.oec.uni-osnabrueck.de> > >> > >> Simon> wrote: > >> >> [Dietrich Trenkler] > >> >> > >> >> > >> >> plot(rnorm(10),xlab=expression(bold(x)),ylab=expression(bold(y))) > >> > >> Simon> Not quite what I am looking for, I'm afraid. \mathbb > >> Simon> gives "blackboard" fonts - the capitals with two > >> Simon> vertical parallel lines in them that are used for the > >> Simon> Reals, Complex numbers etc. > >> > >>yes (and Dieter confused \mathbb{} with \mathbf{}). > >> > >>R's builtin plotmath utilities can't do this directly. > >>A workaround would be similar to what we used to do in LaTeX 2.09 > >>times (before \mathbb{} was standardly available): > >> > >> { "I", <negative space>, "R" } > >> > >>Whereas with (La)TeX, a macro definition was relatively > >>easy for the above, it might be a bit harder / more ugly with > >>current R builtins, for one because I don't think ``plotmath'' > >>has a concept of <negative space>. > >>1) A really ugly hack would work with text() -- not quite useful > >> if you'd like these in 'xlab' etc. > >> > >>2) A potentially much nicer scheme might be to use "grid" instead of > >> oldstyle "graphics" : There one could construct a "grob" > >> (graphical object) for the '|R' symbol that one could should be > >> pass to other functions -- though it may need some tweaking > >> before a function like (pkg lattice's) xyplot() would accept > >> a grob for xlab [instead of only a character or expression]. > > > > > > Interesting thought. Should be almost trivial to implement. > > > > Currently, legends (sort of generalized key-s in the Trellis context) can be > > grobs, e.g. > > > > bbR <- textGrob(c("I", "R"), x = 0.7 * c(-1, 1), > > default.units = "mm", > > vp = viewport(h=0, w=0)) > > > > xyplot(1 ~ 1, xlab = NULL, legend = list(bottom = list(fun = bbR))) > > > Cool :) An alternative hack would be to treat this as an annotation of > the lattice panel. For example ... > > xyplot(1 ~ 1, xlab = "") # NOTE "" not NULL > downViewport("panel.1") > pushViewport(viewport(clip="off")) # to be able to draw outside panel > grid.text(c("I", "R"), y=unit(-2, "lines"), > x=unit(0.5, "npc") - 0.5*stringWidth(c("I", "")), > just="left") > upViewport(0) > > ... (using stringWidth makes the hack scale with font size). > > In this case though, I think the ideal solution would be just to use a > font that has the desired character. On Windows this should be doable > via the file RHOME\etc\Rdevga and something like mtext(..., font=<some > large number>) [assuming that the appropriate font can be found and > installed]. > > Paul > -- > Dr Paul Murrell > Department of Statistics > The University of Auckland > Private Bag 92019 > Auckland > New Zealand > 64 9 3737599 x85392 > paul at stat.auckland.ac.nz > http://www.stat.auckland.ac.nz/~paul/ > > > > ------------------------------ > > Message: 87 > Date: Fri, 27 Aug 2004 00:30:06 +0000 > From: "F Z" <gerifalte28 at hotmail.com> > Subject: [R] FIML in lme > To: R-help at stat.math.ethz.ch > Message-ID: <BAY2-F35FHLqbp3eccm000238e7 at hotmail.com> > Content-Type: text/plain; format=flowed > > Hi > > I was asked if lme can use FIML (Full Information Maximum Likelihood) > instead of REML or ML but I don't know the answer. Does anybody know if > this is implemented in R? > > Thanks > > Francisco > > > > ------------------------------ > > Message: 88 > Date: Fri, 27 Aug 2004 02:47:19 +0200 > From: "Henrik Bengtsson" <hb at maths.lth.se> > Subject: RE: [R] Surprise when mapping matrix to image > To: "'Jim Brennan'" <jfbrennan at rogers.com>, > <rossini at u.washington.edu>, <r-help at stat.math.ethz.ch> > Message-ID: <001201c48bcf$6e51c400$8e0040d5 at hblaptop> > Content-Type: text/plain; charset="us-ascii" > > I've got some simple code example at http://www.maths.lth.se/help/R/image/, > or just try: > > source("http://www.maths.lth.se/help/R/image/image.R") > > Best wishes > > Henrik Bengtsson > > > > -----Original Message----- > > From: r-help-bounces at stat.math.ethz.ch > > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Jim Brennan > > Sent: Friday, August 27, 2004 1:43 AM > > To: rossini at u.washington.edu; r-help at stat.math.ethz.ch > > Subject: Re: [R] Surprise when mapping matrix to image > > > > > > I was also surprised by the image orientation this summer and > > used the "easy" fix of matrix manipulation. There is however > > another issue and that is when you start flipping around the > > matrix, orders etc. and for the case you want to have > > sensibly labeled axes, you may have to use the axis commands > > etc. which is also easy, but accumulation of easy fixes can > > be tedious so there is perhaps some argument for yet another > > new documentation submission. Maybe a method for easily > > changing the orientation in image could be added. > > > > Jim > > ----- Original Message ----- > > From: "A.J. Rossini" <rossini at blindglobe.net> > > To: <r-help at stat.math.ethz.ch> > > Sent: Thursday, August 26, 2004 7:11 PM > > Subject: Re: [R] Surprise when mapping matrix to image > > > > > > > > > > I think I'd have to respectfully disagree with both Brian and > > > Deepayan, as to whether it should be obvious. It is reasonable > > > (principle of least suprise) to expect orientation of the plot to > > > match the print order of the matrix. I would have expected Brian's > > > one-liner to be in the help page, with a notice. It's a > > not-so-rare > > > activity, being a general matrix visualization that is > > commonly used > > > in certain areas of science (whether it ought to be > > commonly used is a > > > separate question). > > > > > > While "heatmap" might've been perhaps a better pointer, but > > it doesn't > > > seem to do the "right" thing, either. I.e. > > > > > > myTemp <- matrix(c(1,2,3,3,2,3),nrow=2) > > > heatmap(myTemp,Rowv=NA,Colv=NA) > > > > > > doesn't look right to me (R Version 1.9.1 (2004-06-21)) > > > > > > I see the "pixmap/bitmap" issue as a bit of a red herring, in this > > > case. > > > > > > best, > > > -tony > > > > > > p.s. I seem to get bit by this about once a year for the last few, > > > hence why I'm speaking up. > > > > > > > > > > > > > > > > > > > > > > > > > > > Deepayan Sarkar <deepayan at cs.wisc.edu> writes: > > > > > > > Quoting "Glynn, Earl" <EFG at Stowers-Institute.org>: > > > > > > > >> Prof Ripley: > > > >> > > > >> Thank you for your prompt reply. > > > >> > > > >> > It's pure convention: see below. > > > >> > > > > >> > Did you try reading the help for image? You don't seem to > > > >> > understand it if you actually did. It seems you are > > looking for > > > >> > > > > >> > image(t(x)[ncol(x):1, ]) > > > >> > > > >> I think you guys are too close to "R" to understand how > > hard it is > > > >> to use sometimes. What may be blatantly obvious to you > > is quite a > > > >> problem especially to beginners. Some of us may be > > beginners to R, > > > >> but we know math, science, programming, and how to solve > > problems > > > >> with other tools and languages. > > > >> > > > >> I re-read the guidelines before posting fearing condemnation. > > > >> > > > >> Before posting I searched the online R-help Google > > interface with > > > >> keywords "image", "flip", "rotate". A discussion from > > 1998 touched > > > >> on this issue but I was hoping that this was deemed a > > "bug" at some > > > >> point and fixed -- or had an easy workaround, like some > > parameter I > > > >> was missing. > > > >> > > > >> I read the "?image" help before posting. Was the part I didn't > > > >> understand buried in this "note"? > > > >> > > > >> "Based on a function by Thomas Lumley > > > >> tlumley at u.washington.edu." > > > > > > > > You seem to be thinking that Prof Ripley's solution had > > something to > > > > do > > with > > > > image(). It doesn't, it has to do with manipulating a matrix. > > > > image() visualizes a matrix in a particular and well-defined way. > > > > You want your > > matrix > > > > to be shown in a different way, and one (simple) way of > > doing that > > > > is to convert your matrix into a different matrix, on > > which calling > > > > image > > would give > > > > you what you want. Why would this be explained in ?image > > ? This is > > > > basic > > R. > > > > > > > > More generally, I think your frustration is caused by your > > > > expectation > > that a > > > > matrix object should behave like a bitmap image. It > > doesn't. If you > > > > want > > work > > > > with images, use the pixmap package. > > > > > > > > Deepayan > > > > > > > > ______________________________________________ > > > > R-help at 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 > > > > > > > > > > -- > > > Anthony Rossini Research Associate Professor > > > rossini at u.washington.edu > > http://www.analytics.washington.edu/ > > > Biomedical and Health Informatics University of Washington > > > Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer > > Research Center > > > UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is > > unreliable > > > FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email > > > > > > CONFIDENTIALITY NOTICE: This e-mail message and any > > > attachme...{{dropped}} > > > > > > ______________________________________________ > > > R-help at 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 > > > > ______________________________________________ > > R-help at 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 > > > > > > > > ------------------------------ > > Message: 89 > Date: Thu, 26 Aug 2004 17:55:17 -0700 > From: "Michael Jerosch-Herold" <jeroschh at ohsu.edu> > Subject: [R] read.spss warning: unrecognized record type?? > To: r-help at stat.math.ethz.ch > Message-ID: <s12e2412.032 at ohsu.edu> > Content-Type: text/plain; charset=us-ascii > > When using read.spss (library: 'foreign') I get the following warning > message: > > Warning message: > E:/R4win/mesamri.sav: Unrecognized record type 7, subtype 13 > encountered in system file. > > I don't see anything wrong with record #7 in the database I am trying > to read in, but I suspect that the warning message does not refer to a > specific record, but a "variable" type. Is this correct? And what does > "subtype 13" mean? > > I basically have a data table with records (cases) in rows, and various > variables for each record/case in the columns. Again, I suspect that I > am using "record" in a different sense then meant by the above warning > message. > > Based on this warning, is "record type 7" discarded when the data are > read in? > > Thank you in advance for shedding some light on this! > > Michael Jerosch-Herold > > > > ------------------------------ > > Message: 90 > Date: Fri, 27 Aug 2004 13:19:15 +1200 (NZST) > From: David Scott <d.scott at auckland.ac.nz> > Subject: Re: [R] Plotting groupedData objects > To: Deepayan Sarkar <deepayan at cs.wisc.edu> > Cc: r-help at stat.math.ethz.ch, David Scott <d.scott at auckland.ac.nz> > Message-ID: > <Pine.LNX.4.44.0408271305540.31281-100000 at hydra.stat.auckland.ac.nz> > Content-Type: TEXT/PLAIN; charset=US-ASCII > > On Thu, 26 Aug 2004, Deepayan Sarkar wrote: > > > Quoting David Scott <d.scott at auckland.ac.nz>: > > > > > On Thu, 26 Aug 2004, Deepayan Sarkar wrote: > > > > > > > Quoting David Scott <d.scott at auckland.ac.nz>: > > > > > > > > > > > > > > I am trying to create a plot similar to Figure 3.2 in Bates and > > > Pinheiro. > > > > > > > > > > I have repeated measurements on about 80 subjects from 2 treatment > > > groups. > > > > > I would like to have the panels for the two treatment groups in separate > > > > > groups and within those groups have the panels ordered on maximum value > > > > > (as is the default). > > > > > > > > > > I am ok with getting plots similar to Figs 3.1 and 3.2, but can't see how > > > > > > > > to change the ordering of the panels to what I want. > > > > > > > > > > Here is the definition of my groupedData object > > > > > > > > > > RAWlmeData <- groupedData(RAW~Elapsed|ID, > > > > > data=RAWData, > > > > > labels=list(x="Elapsed time",y="Airways resistance"), > > > > > units=list(x="(hours)",y="cm H20/L/sec")) > > > > > > > > > > I guess I could just plot the two treatment groups separately in turn but > > > > > > > > I feel there is something I am missing. > > > > > > > > My reading of page 105 suggests that you need to specify > > > > 'outer=<whatever your grouping factor is>'. > > > > Have you tried that? > > > > > > > I did try that. It produces Fig 3.3 with multiple lines giving the results > > > for each subject by treatment. With around 40 subjects per treatment > > > group, that isn't very attractive in my case. > > > > I should have been more specific, but I thought this was clear enough in the > > book. I was talking about specifying outer in the groupedData() constructor, > > not in the plot() call. Have you tried _that_? > > > > > I should also mention that I looked for on-line complements to Pinheiro > > > and Bates, and found MEMSS.tar.gz on > > > http://cm.bell-labs.com/cm/ms/departments/sia/NLME/MEMSS/index.html > > > which promised scripts for the examples in the book but turned out to have > > > only chapters 1 and 2, and for S-PLUS rather than R (going on the .q > > > extension). > > > > The R scripts are, naturally enough, bundled with the R version of the package. > > They should be in the scripts/ subdirectory of your nlme installation. > > > Thanks Deepayan. I didn't read that section closely enough. Defining an > outer factor in the constructor did what I wanted. > > I also found the scripts as you suggested although they didn't include > code for the production of Fig 3.2 as far as I could see. > > > David Scott > > > > > > > > > > _________________________________________________________________ > David Scott Department of Statistics, Tamaki Campus > The University of Auckland, PB 92019 > Auckland NEW ZEALAND > Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000 > Email: d.scott at auckland.ac.nz > > > Graduate Officer, Department of Statistics > > > > ------------------------------ > > Message: 91 > Date: Thu, 26 Aug 2004 20:26:53 -0500 > From: Deepayan Sarkar <deepayan at cs.wisc.edu> > Subject: Re: [R] introduction slides for beginners > To: Deepayan Sarkar <deepayan at cs.wisc.edu> > Cc: Armin Roehrl <armin at xss.de>, r-help at stat.math.ethz.ch > Message-ID: <1093570013.412e8ddd1ac2b at www-auth.cs.wisc.edu> > Content-Type: text/plain; charset=utf-8 > > Quoting Deepayan Sarkar <deepayan at cs.wisc.edu>: > > > On Thu, 26 Aug 2004, Armin Roehrl wrote: > > > > > Hi all, > > > > > > does anybody have slides for a 1 to 3 hour crash course into R, > > > that I would be allowed to recycle to show a few people the light? > > > > I have some stuff I used for 5 x 1 hour presentations at > > > > http://www.stat.wisc.edu/~deepayan/SIBS/slides/ > > > > meant to complement the first chapter of 'An Introduction to R'. > > Umm, for the record, I meant to say 'Introductory Statistics with R' here. > > Deepayan > > > > ------------------------------ > > Message: 92 > Date: Fri, 27 Aug 2004 14:19:27 +1200 (NZST) > From: "Richard A. O'Keefe" <ok at cs.otago.ac.nz> > Subject: RE: [R] Surprise when mapping matrix to image > To: r-help at stat.math.ethz.ch > Message-ID: <200408270219.i7R2JRQN413645 at atlas.otago.ac.nz> > > Deepayan Sarkar <deepayan at cs.wisc.edu> wrote: > You seem to be thinking that Prof Ripley's solution had > something to do with image(). > > "Glynn, Earl" <EFG at Stowers-Institute.org> > could certainly be excused for thinking so, because > what Prof Ripley wrote included this: > > > > Did you try reading the help for image? You don't seem to > > > understand it if you actually did. > > That certainly sounds to me as though the answer should have been > obvious from ?image > > Now, the image() function is trying to be extremely helpful and offers > you lots of ways of providing the data, and that is explained in ?image. > > In fact a key piece of information *IS* in ?image, so it really DOES > have something to do with image(): > > Details: > > The length of 'x' should be equal to the 'nrow(z)+1' or 'nrow(z)'. > In the first case 'x' specifies the boundaries between the cells: > in the second case 'x' specifies the midpoints of the cells. > > This tells us that the "x" direction of the image goes along the *rows* > of the matrix and by implication that the "y" direction goes along the > *columns* of the matrix, and is precisely what you need to figure out > that image(t(x)) is the thing to use. > > One does have to be a little subtle at reading between the lines to see > the relevance of details about a parameter one is not passing, but the > information _is_ there and it _is_ 'something to do with image()', not > something to do with matrices. > > The 'volcano' example from ?image also points the same way. > > The basic problem here is that the standard visual layout of > matrices sets up such a strong expectation that it's difficult for > any text to override it. > > I don't see anything that explicitly discusses the direction of the > axes, I don't see anything explicit, but I took it that ?image would > follow the usual "horizontal axis increases from left to right, > vertical axis increases from bottom to top" convention, which means > "horizontal gives ROW number increasing left to right, > vertical gives COLUMN number increasing bottom to top" > so when I do image(t(x)) I see my columns as vertical strips but > they are "upside down", so the last step, to > image(t(x)[ncol(x):1,]) > does make sense, provided you read ?image as *implying* without actually > stating "follows the usual graphical conventions for axes". But again, > this really is a fact about image(), not about matrices. > > As for the claim that > It doesn't, it has to do with manipulating a matrix. image() > visualizes a matrix in a particular and well-defined way. > > Well yes, it is a particular way, and I suppose you could say that the > code is defined well, but it really isn't, when you get right down to > it, and *EXPLICITLY* documented way. You really have to work at it. > > This is NOT a criticism of R documentation. Of all the open-source > programs I use, I reckon R is by far the best documented, and its > on-line documentation can more than withstand comparison against most > of the commercial programs I've seen. The real problem is that R is > just so big and there are only so many people writing documentation for > it. > > Given the wide range of ways that the x, y, z arguments can be passed > to image(), it would actually make sense to have some kind of flip and/or > mirror operations specified via an argument to image(). > The source code of image is available (image.default) so it wouldn't be > a lot of work for someone who wants it to produce such a thing. > > > > ------------------------------ > > Message: 93 > Date: Thu, 26 Aug 2004 22:39:43 -0400 > From: "Liaw, Andy" <andy_liaw at merck.com> > Subject: RE: [R] predict.mvr error message > To: "'Stewart T Chang'" <stchang at umich.edu>, r-help at stat.math.ethz.ch > Message-ID: > <3A822319EB35174CA3714066D590DCD504AF82AA at usrymx25.merck.com> > Content-Type: text/plain > > What version of R, what version of pls.pcr, and on what OS? Have you > checked whether your versions of software are up to date? I get: > > > n <- 1350 > > p <- 180 > > y <- rnorm(n) > > x <- matrix(sample(0:1, n*p, replace=TRUE), n, p) > > fit <- mvr(x, y, method="SIMPLS", validat="none", ncomp=2) > > xt <- matrix(sample(0:1, 312*p, replace=TRUE), 312, p) > > yt <- predict(fit, xt) > > > Andy > > > From: Stewart T Chang > > > > Greetings, > > > > I've encountered an error message while using the pls.pcr package > > that's left me scratching my head for a couple of hours, and > > I thought I > > might post it here in the hopes that someone else uses this package. > > Using a data set of 1350 observations (each observation comprises 180 > > predictor variables and 1 output variable), I trained a model using > > pls.pcr. (Other details: ncomp=2, > > method="SIMPLS",validation="none". I > > might also add that each predictor variable has a value of > > either 0 or 1, > > though the output variable is a real number.) > > ' > > When I tried to use this model to make predictions (on 312 sets of 180 > > predictor variables), I received the following error: > > > > Error in X %*% object$training$B[, , index, drop = TRUE] : > > requires numeric matrix/vector arguments > > > > Normally I'd ask a friend of mine in Biostatistics here to > > help me out, > > but he's currently away! Have any of you used pls.pcr and gotten this > > kind of message? Thanks! > > > > Stewart > > > > ______________________________________________ > > R-help at 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 > > > > > > > > ------------------------------ > > Message: 94 > Date: Thu, 26 Aug 2004 22:50:56 -0400 (EDT) > From: Stewart T Chang <stchang at umich.edu> > Subject: RE: [R] predict.mvr error message > To: "Liaw, Andy" <andy_liaw at merck.com> > Cc: r-help at stat.math.ethz.ch > Message-ID: > <Pine.SOL.4.58.0408262241430.18266 at timepilot.gpcc.itd.umich.edu> > Content-Type: TEXT/PLAIN; charset=US-ASCII > > Well, I figured it out on my own. It turns out, even though my test set > of data appeared to be a matrix, it wasn't. Adding "as.matrix" to the > front of the name of the data set solved the problem. (Maybe there's some > alternative way of doing it, such as yours?) Thanks for your suggestion. > > Stewart > > > > On Thu, 26 Aug 2004, Liaw, Andy wrote: > > > What version of R, what version of pls.pcr, and on what OS? Have you > > checked whether your versions of software are up to date? I get: > > > > > n <- 1350 > > > p <- 180 > > > y <- rnorm(n) > > > x <- matrix(sample(0:1, n*p, replace=TRUE), n, p) > > > fit <- mvr(x, y, method="SIMPLS", validat="none", ncomp=2) > > > xt <- matrix(sample(0:1, 312*p, replace=TRUE), 312, p) > > > yt <- predict(fit, xt) > > > > > > Andy > > > > > From: Stewart T Chang > > > > > > Greetings, > > > > > > I've encountered an error message while using the pls.pcr package > > > that's left me scratching my head for a couple of hours, and > > > I thought I > > > might post it here in the hopes that someone else uses this package. > > > Using a data set of 1350 observations (each observation comprises 180 > > > predictor variables and 1 output variable), I trained a model using > > > pls.pcr. (Other details: ncomp=2, > > > method="SIMPLS",validation="none". I > > > might also add that each predictor variable has a value of > > > either 0 or 1, > > > though the output variable is a real number.) > > > ' > > > When I tried to use this model to make predictions (on 312 sets of 180 > > > predictor variables), I received the following error: > > > > > > Error in X %*% object$training$B[, , index, drop = TRUE] : > > > requires numeric matrix/vector arguments > > > > > > Normally I'd ask a friend of mine in Biostatistics here to > > > help me out, > > > but he's currently away! Have any of you used pls.pcr and gotten this > > > kind of message? Thanks! > > > > > > Stewart > > > > > > ______________________________________________ > > > R-help at 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 > > > > > > > > > > > > ------------------------------------------------------------------------------ > > Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. > > ------------------------------------------------------------------------------ > > > > > > > > > > ------------------------------ > > Message: 95 > Date: Thu, 26 Aug 2004 23:08:07 -0400 > From: "Liaw, Andy" <andy_liaw at merck.com> > Subject: RE: [R] Surprise when mapping matrix to image > To: "'Richard A. O'Keefe'" <ok at cs.otago.ac.nz>, > r-help at stat.math.ethz.ch > Message-ID: > <3A822319EB35174CA3714066D590DCD504AF82AB at usrymx25.merck.com> > Content-Type: text/plain > > > From: Richard A. O'Keefe > [snip] > > Given the wide range of ways that the x, y, z arguments can be passed > > to image(), it would actually make sense to have some kind of > > flip and/or > > mirror operations specified via an argument to image(). > > The source code of image is available (image.default) so it > > wouldn't be > > a lot of work for someone who wants it to produce such a thing. > > I'd suggest adding an `as.matrix' argument to image.default. > > Best, > Andy > > > > ------------------------------ > > Message: 96 > Date: Thu, 26 Aug 2004 22:16:23 -0500 > From: Deepayan Sarkar <deepayan at cs.wisc.edu> > Subject: RE: [R] Surprise when mapping matrix to image > To: "Richard A. O'Keefe" <ok at cs.otago.ac.nz> > Cc: r-help at stat.math.ethz.ch > Message-ID: <1093576583.412ea7876ee02 at www-auth.cs.wisc.edu> > Content-Type: text/plain; charset=utf-8 > > Quoting "Richard A. O'Keefe" <ok at cs.otago.ac.nz>: > > > Deepayan Sarkar <deepayan at cs.wisc.edu> wrote: > > You seem to be thinking that Prof Ripley's solution had > > something to do with image(). > > > > "Glynn, Earl" <EFG at Stowers-Institute.org> > > could certainly be excused for thinking so, because > > what Prof Ripley wrote included this: > > > > > > Did you try reading the help for image? You don't seem to > > > > understand it if you actually did. > > > > That certainly sounds to me as though the answer should have been > > obvious from ?image > > I agree with you that the issues are related, but your (edited) quoting is > misleading. I interpret Prof Ripley's comment as implying that reading ?image > would tell the user what happens when he calls image(x). This is distinct from > how to manipulate a matrix, which is what t(x)[ncol(x):1, ] is doing. It > doesn't seem obvious to me that this information should be in ?image, and I > still don't see how Prof Ripley's comment suggested that it was. Anything but > the most trivial use of S involves combining different ideas. One can hardly > expect all possible interactions to be documented. > > Of course, documentation can always use improvements (and the rest of your > comments on ?image are all valid), and it would be nice to anticipate > frequently faced problems and offer solutions preemptively, but that's a > different issue. > > Deepayan > > > > ------------------------------ > > Message: 97 > Date: Fri, 27 Aug 2004 16:22:15 +1200 (NZST) > From: "Richard A. O'Keefe" <ok at cs.otago.ac.nz> > Subject: RE: [R] Surprise when mapping matrix to image > To: r-help at stat.math.ethz.ch > Message-ID: <200408270422.i7R4MFF7409020 at atlas.otago.ac.nz> > > Deepayan Sarkar <deepayan at cs.wisc.edu> wrote: > I agree with you that the issues are related, but your (edited) quoting is > misleading. > > My quotes were selective but not otherwise edited. > > I interpret Prof Ripley's comment as implying that reading ?image > would tell the user what happens when he calls image(x). > > And that's how I interpreted it too. > > This is distinct from how to manipulate a matrix, which is what > t(x)[ncol(x):1, ] is doing. It doesn't seem obvious to me that this > information should be in ?image, > > Nobody whatsoever has suggested that the matrix manipulation code *SHOULD* > be in ?image. Nobody. Not me. Not anyone else. The original poster's > problem was not "how do I manipulate a matrix" but "why is the image the > wrong way around". > > and I still don't see how Prof Ripley's > comment suggested that it was. > > It didn't. NOBODY has made any such suggestion. > > One can hardly expect all possible interactions to be documented. > > Nobody has suggested that either. > > All I was saying is this: > (1) The original poster's problem was a problem about image(), > NOT a problem about matrix manipulation. > (2) We have no reason whatsoever to assert, hint, believe, or opine > that the original poster was any less competent at matrix manipulation > per se than anyone else reading this mail list. He didn't have a > matrix problem. > (3) The problem basically is precisely where Prof Ripley located it: > a clash between > (a) an extremely strong "cultural" expectation that the elements > of a matrix will be presented with rows running from 1 at top > to m at bottom and columns running from 1 at left to n at right, and > (b) an extremely strong "cultural" expectation that the vertical > axis of a plot runs from low at the bottom to high at the top, and > (c) the fact that image() maps the "row" axis of a matrix to the > horizontal axis of a plot and the "column" axis of a matrix to > the vertical axis of a plot. > Expectations (a) and (b) are not only part of general computing, > they are strongly supported by R itself. As for (c), it doesn't > seem to me that it _had_ to be that way. > (4) Point (c) is a sufficiently strange quirk of image() that it is > a stumbling block waiting to trip people up. I've stumbled over > it myself, which is how come I knew where to look in ?image. > That makes it *essential* that it should be documented. > (5) And it *IS* documented. It really is an image() problem, not a > matrix problem, and the essential part of it *IS* documented. > > Pointing out that a obvious nasty interaction *is* documented is > hardly a demand that all possible interactions should be documented. > > How about this addition to the documentation? > > "The x axis corresponds to the rows of the matrix (first on the left > to last on the right). The y axis corresponds to the columns of the > matrix (first at the bottom to last at the top)." > > Once you know what image() is _intended_ to do with a matrix, > you can figure out the transposing and reversing you need for any > other view. It's knowing you need to that's the problem. > > > > ------------------------------ > > Message: 98 > Date: Thu, 26 Aug 2004 21:59:21 -0700 > From: rossini at blindglobe.net (A.J. Rossini) > Subject: Re: [R] Surprise when mapping matrix to image > To: "Richard A. O'Keefe" <ok at cs.otago.ac.nz> > Cc: r-help at stat.math.ethz.ch > Message-ID: <85llg1tbva.fsf at servant.blindglobe.net> > Content-Type: text/plain; charset=us-ascii > > "Richard A. O'Keefe" <ok at cs.otago.ac.nz> writes: > > > Once you know what image() is _intended_ to do with a matrix, > > you can figure out the transposing and reversing you need for any > > other view. It's knowing you need to that's the problem. > > This is a much better statement of my point, and precisely why it > keeps (though only occassionally) burning me. > > best, > -tony > > -- > Anthony Rossini Research Associate Professor > rossini at u.washington.edu http://www.analytics.washington.edu/ > Biomedical and Health Informatics University of Washington > Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center > UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable > FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email > > CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} > > > > ------------------------------ > > Message: 99 > Date: Fri, 27 Aug 2004 13:03:45 +0800 > From: Neil Leonard <nleonard at tartarus.uwa.edu.au> > Subject: [R] Keyboard input into functions > To: r-help at stat.math.ethz.ch > Message-ID: <797B336F-F7E6-11D8-8BC2-003065D5B8EC at tartarus.uwa.edu.au> > Content-Type: text/plain; charset=US-ASCII; format=flowed > > Hi, > > Does anybody know if it is possible to have keyboard input into > functions? Kind of like 'scanf()' in C. > > I want to write a function that asks me what to put in certain > variables. > > > Thanks, > Neil > > > > ------------------------------ > > Message: 100 > Date: Fri, 27 Aug 2004 14:11:14 +0900 > From: "Manoj - Hachibushu Capital" <Wanzare at HCJP.com> > Subject: RE: [R] Keyboard input into functions > To: "Neil Leonard" <nleonard at tartarus.uwa.edu.au>, > <r-help at stat.math.ethz.ch> > Message-ID: > <1CBA12F2D414914989C723D196B287DC26BCD1 at jp-svr-ex1.hcjp.com> > Content-Type: text/plain; charset="us-ascii" > > ?readline > > HTH > -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Neil Leonard > Sent: Friday, August 27, 2004 2:04 PM > To: r-help at stat.math.ethz.ch > Subject: [R] Keyboard input into functions > > Hi, > > Does anybody know if it is possible to have keyboard input into > functions? Kind of like 'scanf()' in C. > > I want to write a function that asks me what to put in certain > variables. > > > Thanks, > Neil > > ______________________________________________ > R-help at 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 > > > > ------------------------------ > > Message: 101 > Date: Fri, 27 Aug 2004 07:50:59 +0100 (BST) > From: Prof Brian Ripley <ripley at stats.ox.ac.uk> > Subject: Re: [R] Error TukeyHSD > To: "T. Murlidharan Nair" <nair at sdsc.edu> > Cc: r-help at stat.math.ethz.ch > Message-ID: <Pine.LNX.4.44.0408270747580.30532-100000 at gannet.stats> > Content-Type: TEXT/PLAIN; charset=US-ASCII > > You are trying to apply TukeyHSD to a linear regression. I think you want > `diet' to be a factor, but it is not. (The warning message told you > that.) The model needs to be > > coag.mod <- aov(time ~ factor(diet), data=coag) > > Function aov happily accepts continuous covariates as it can also do > ANCOVA. > > On Thu, 26 Aug 2004, T. Murlidharan Nair wrote: > > > I am running the following code on the coagulation data and I am getting > > an error. Please let me know > > if I am missing anything from my code. > > > > coag<- matrix( scan("//Samba3/nair/R/blood.dat", sep=","), 24, 3, > > byrow=TRUE) > > colnames(coag) <- c("time","diet","order") > > coag <- as.data.frame(coag) > > oneway.test(time ~ diet, data=coag, var.eq=TRUE) > > coag.mod <- aov(time ~ diet, data=coag) > > options(scipen=5) > > options(digits=5) > > TukeyHSD( coag.mod ) > > > > > > I get the following error when I run the above code > > Read 72 items > > Error in rep.int(n, length(means)) : Unimplemented feature in rep > > In addition: Warning message: > > non-factors ignored: diet in: replications(paste("~", > > paste(names(tables), collapse = "+")), > > -- > Brian D. Ripley, ripley at stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 > > > > ------------------------------ > > Message: 102 > Date: 27 Aug 2004 08:46:57 +0200 > From: Peter Dalgaard <p.dalgaard at biostat.ku.dk> > Subject: Re: [R] Surprise when mapping matrix to image > To: "Richard A. O'Keefe" <ok at cs.otago.ac.nz> > Cc: r-help at stat.math.ethz.ch > Message-ID: <x2pt5d13j2.fsf at biostat.ku.dk> > Content-Type: text/plain; charset=us-ascii > > "Richard A. O'Keefe" <ok at cs.otago.ac.nz> writes: > > > How about this addition to the documentation? > > > > "The x axis corresponds to the rows of the matrix (first on the left > > to last on the right). The y axis corresponds to the columns of the > > matrix (first at the bottom to last at the top)." > > > > Once you know what image() is _intended_ to do with a matrix, > > you can figure out the transposing and reversing you need for any > > other view. It's knowing you need to that's the problem. > > Good idea, but perhaps not phrased sharply enough to catch the user's > eye. How about something like this: > > "Notice that image() interprets a matrix as a table of f(x_i, y_j), so > the x axis corresponds to row number and the y axis to column number > (bottom to top)." > > and then use Brian's one-liner in the examples section? > > -- > O__ ---- Peter Dalgaard Blegdamsvej 3 > c/ /'_ --- Dept. of Biostatistics 2200 Cph. N > (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 > ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 > > > > ------------------------------ > > Message: 103 > Date: Fri, 27 Aug 2004 07:55:46 +0100 (BST) > From: Prof Brian Ripley <ripley at stats.ox.ac.uk> > Subject: Re: [R] coplot and par > To: Mihai Nica <m_nica at hotmail.com> > Cc: r-help at stat.math.ethz.ch > Message-ID: <Pine.LNX.4.44.0408270751220.30532-100000 at gannet.stats> > Content-Type: TEXT/PLAIN; charset=US-ASCII > > On Thu, 26 Aug 2004, Mihai Nica wrote: > > > R 1.9.1 on Win2000 or Win98SE. > > > > I am using coplot as follows: > > > > coplot(AVG~LRPI| REGION) > > > > the output seems normal but I get: > > > > "Warning message: > > calling par(new=) with no plot" > > >From the NEWS file for R-patched: > > o coplot(..) doesn't give an extraneous warning anymore when called > on a fresh device. > > so it is a bug that is fixed in the latest version (which you cna find on > CRAN). > > > > This is the only explanation that I have for being unable to use par() with > > coplot for changing the way the xlab and ylab appears. > > xlab and ylab are not part of par -- see its help page. > > > From within coplot I can change the text itself but not the font, > > fontsize, etc, but par() before coplot has absolutely no effect > > wahtsoever (maybe it isn't supposed to?). > > > > I guess the question is: how can one change the way the xlab and ylab appear > > on a coplot? > > They are listed as arguments to coplot, and work for me when given there. > > -- > Brian D. Ripley, ripley at stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 > > > > ------------------------------ > > Message: 104 > Date: Fri, 27 Aug 2004 08:07:52 +0100 (BST) > From: Prof Brian Ripley <ripley at stats.ox.ac.uk> > Subject: RE: [R] Keyboard input into functions > To: Manoj - Hachibushu Capital <Wanzare at hcjp.com> > Cc: r-help at stat.math.ethz.ch > Message-ID: <Pine.LNX.4.44.0408270806140.30532-100000 at gannet.stats> > Content-Type: TEXT/PLAIN; charset=US-ASCII > > On Fri, 27 Aug 2004, Manoj - Hachibushu Capital wrote: > > > ?readline > > Yes, but a nearer equivalent to scanf in C is scan() which reads from the > keyboard by default. > > > -----Original Message----- > > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Neil Leonard > > Sent: Friday, August 27, 2004 2:04 PM > > > > Does anybody know if it is possible to have keyboard input into > > functions? Kind of like 'scanf()' in C. > > > > I want to write a function that asks me what to put in certain > > variables. > > -- > Brian D. Ripley, ripley at stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 > > > > ------------------------------ > > Message: 105 > Date: Fri, 27 Aug 2004 09:21:39 +0200 > From: "Petr Pikal" <petr.pikal at precheza.cz> > Subject: RE: [R] Surprise when mapping matrix to image > To: "Glynn, Earl" <EFG at Stowers-Institute.org> > Cc: r-help at stat.math.ethz.ch > Message-ID: <412EFD23.249.3B1DE9 at localhost> > Content-Type: text/plain; charset=US-ASCII > > > > On 26 Aug 2004 at 16:47, Glynn, Earl wrote: > > <snip> > > > I'll go back to lurking in the daily R-Helps and not ask any more > > questions until I've read all the old R-help messages. I'm working on > > December 1998 right now and reading forward. Perhaps by next year > > I'll will have read all the old R-help postings and I'll dare ask > > another question then. > > Hi > > When I do not find something in help page and a function does not > do what I want I usually consult Paul Johnson's Rtips (or > StatsRUs). Its a first hit by Google "statsrus". There you can find > impresive collection of hints neatly arranged. And probably after a > while you will collect some usefull hints yourself (as I myself > collected). > > Cheers. > Petr > > > > > efg > > > > ______________________________________________ > > R-help at 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 > > Petr Pikal > petr.pikal at precheza.cz > > > > ------------------------------ > > Message: 106 > Date: 27 Aug 2004 09:17:45 +0200 > From: Peter Dalgaard <p.dalgaard at biostat.ku.dk> > Subject: Re: [R] read.spss warning: unrecognized record type?? > To: "Michael Jerosch-Herold" <jeroschh at ohsu.edu> > Cc: r-help at stat.math.ethz.ch > Message-ID: <x2llg1123q.fsf at biostat.ku.dk> > Content-Type: text/plain; charset=us-ascii > > "Michael Jerosch-Herold" <jeroschh at ohsu.edu> writes: > > > When using read.spss (library: 'foreign') I get the following warning > > message: > > > > Warning message: > > E:/R4win/mesamri.sav: Unrecognized record type 7, subtype 13 > > encountered in system file. > > > > I don't see anything wrong with record #7 in the database I am trying > > to read in, but I suspect that the warning message does not refer to a > > specific record, but a "variable" type. Is this correct? And what does > > "subtype 13" mean? > > Well foreign doesn't know either, and that's the problem... Most > likely you have one of your SPSS variables coded in an unusual manner > (do they all come though alright?), or it is something else in the > meta-info that foreign cannot interpret. > > > I basically have a data table with records (cases) in rows, and various > > variables for each record/case in the columns. Again, I suspect that I > > am using "record" in a different sense then meant by the above warning > > message. > > Yes. System files are typically organised in "records" which are not > the actual data records but pieces of meta-information. As in (I'm > just making this up, read the sources for the exact definitions) > > type=1 subtype=1 length=22 data1="My very important data" > > which is compactly stored as (<..> meaning "binary coding of") > > <1><1><22>My very... > > so that on reading, the program sees the first two bytes and then > knows that this is a "main header" and that it will be followed by a > 2-byte length and then as many characters as the length indicates. > > There are other record types for individual variable names, variable > types, variable labels, value labels for categorical data, etc... > > > > Based on this warning, is "record type 7" discarded when the data are > > read in? > > Possibly, but you have the data to check and we don't.... > > > Thank you in advance for shedding some light on this! > > -- > O__ ---- Peter Dalgaard Blegdamsvej 3 > c/ /'_ --- Dept. of Biostatistics 2200 Cph. N > (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 > ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 > > > > ------------------------------ > > Message: 107 > Date: Fri, 27 Aug 2004 08:33:25 +0100 (BST) > From: Prof Brian Ripley <ripley at stats.ox.ac.uk> > Subject: Re: [R] coplot and par > To: Mihai Nica <m_nica at hotmail.com> > Cc: r-help at stat.math.ethz.ch > Message-ID: <Pine.LNX.4.44.0408270822590.30632-100000 at gannet.stats> > Content-Type: TEXT/PLAIN; charset=US-ASCII > > On Fri, 27 Aug 2004, Prof Brian Ripley wrote: > > > On Thu, 26 Aug 2004, Mihai Nica wrote: > > [...] > > > > This is the only explanation that I have for being unable to use par() with > > > coplot for changing the way the xlab and ylab appears. > > > > xlab and ylab are not part of par -- see its help page. > > > > > From within coplot I can change the text itself but not the font, > > > fontsize, etc, but par() before coplot has absolutely no effect > > > wahtsoever (maybe it isn't supposed to?). > > > > > > I guess the question is: how can one change the way the xlab and ylab appear > > > on a coplot? > > > > They are listed as arguments to coplot, and work for me when given there. > > Although you didn't mention them at all, did you mean specifying cex.lab > and font.lab? They do not work as the xlab and ylab in coplot are not > `x and y labels' in the sense used in ?par: they are placed by mtext() not > title(). > > -- > Brian D. Ripley, ripley at stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 > > > > ------------------------------ > > Message: 108 > Date: Fri, 27 Aug 2004 09:37:12 +0200 > From: Uwe Ligges <ligges at statistik.uni-dortmund.de> > Subject: Re: [R] text() with text, variables and math HOWTO? > To: Johannes Graumann <graumann at its.caltech.edu> > Cc: r-help at stat.math.ethz.ch > Message-ID: <412EE4A8.2090503 at statistik.uni-dortmund.de> > Content-Type: text/plain; charset=us-ascii; format=flowed > > Johannes Graumann wrote: > > > Hello, > > > > One more question from the 'abusing R for blotting - particularly > > anally' department: > > How can I in the expression below make the '%~~%' show up as the > > aprrox-sign I want it to be? > > > > Thanks for any hint, > > > > Joh > > > > text( > > 500,1.5, > > cex=0.75, > > substitute( > > paste( > > OD[600][~nm], > > " of 1 at ", > > time1, > > " min ", > > "%~~%", > > time1h, > > "h" > > ), > > list( > > time1=round(time1,digits=0), > > time1h=round(time1/60,digits=1) > > ) > > ) > > ) > > > substitute(OD[600][~nm] * " of 1 at " * > time1 * " min" %~~% time1h * h, > list(time1=round(time1,digits=0), > time1h=round(time1/60,digits=1)) > ) > > > > Uwe Ligges > > > > > ______________________________________________ > > R-help at 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 > > > > ------------------------------ > > Message: 109 > Date: Fri, 27 Aug 2004 09:35:07 +0200 > From: Raphael Schneider <rasch at med1.med.tum.de> > Subject: Re: [R] read.spss warning: unrecognized record type?? > To: r-help at stat.math.ethz.ch > Message-ID: <200408270935.07786.rasch at med1.med.tum.de> > Content-Type: text/plain; charset="iso-8859-1" > > On Friday 27 August 2004 02:55, Michael Jerosch-Herold wrote: > > When using read.spss (library: 'foreign') I get the following warning > > message: > > > > Warning message: > > E:/R4win/mesamri.sav: Unrecognized record type 7, subtype 13 > > encountered in system file. > > > > I don't see anything wrong with record #7 in the database I am trying > > to read in, but I suspect that the warning message does not refer to a > > specific record, but a "variable" type. Is this correct? And what does > > "subtype 13" mean? > I get the same message but it seems that all data is read correctly. My > impression is that this message shows up only reading datasets stored with > SPSS12. At the moment I have no dataset where I know exactly this was stored > using a SPSS version below 12. > > Raphael > > > > ------------------------------ > > Message: 110 > Date: Fri, 27 Aug 2004 09:53:00 +0200 > From: Thomas Petzoldt <thpe at hhbio.wasser.tu-dresden.de> > Subject: Re: [R] text() with text, variables and math HOWTO? > To: Johannes Graumann <graumann at its.caltech.edu> > Cc: r-help at stat.math.ethz.ch > Message-ID: <412EE85C.9020009 at hhbio.wasser.tu-dresden.de> > Content-Type: text/plain; charset=us-ascii; format=flowed > > Johannes Graumann wrote: > > Hello, > > > > One more question from the 'abusing R for blotting - particularly > > anally' department: > > How can I in the expression below make the '%~~%' show up as the > > aprrox-sign I want it to be? > > > > Thanks for any hint, > > Your code does not work because "%~~%" is a character string and %~~% is > an invalid mathematical expression. The operator (e.g. %~~%) must be > between something, so it works if you use phantom(0)%~~%phantom(0), and > I found that phantom() without 0 works too: > > See the following: > > > plot(0, xlim=c(0,1000), ylim=c(0,2), type="n") > > time1=99 > > text( > 500,1.5, > cex=0.75, > substitute( > paste( > OD[600][~nm], > " of 1 at ", > time1, > " min ", > phantom()%~~%phantom(), > time1h, > "h" > ), > list( > time1=round(time1,digits=0), > time1h=round(time1/60,digits=1) > ) > ) > ) > > Hope it helps > > Thomas P. > > > > ------------------------------ > > Message: 111 > Date: Fri, 27 Aug 2004 09:58:43 +0200 (CEST) > From: Roger Bivand <Roger.Bivand at nhh.no> > Subject: Re: [R] Newbie Question: Spatial Autocorrelation with R > Tutorial? > To: Jeff Hollister <jeff at edc.uri.edu> > Cc: r-help at stat.math.ethz.ch > Message-ID: <Pine.LNX.4.44.0408270933110.20757-100000 at reclus.nhh.no> > Content-Type: TEXT/PLAIN; charset=ISO-8859-1 > > On Wed, 25 Aug 2004, Jeff Hollister wrote: > > > Howdy All, > > > > I am looking for some good tutorials (books, websites, whatever) for > > calculating/testing for Spatial Autocorrelation using R. > > > > Specifically, I am wanting to test for autocorrelation of a number of > > variables measured at a set of discrete locations. > > > > >From your signature line, "Environmental Data", spatial autocorrelation > could mean a number of things, depending on whether the variables could be > measurements of a continuous surface of values at your discrete locations, > or whether the discrete locations are "spatial entities" formed as areal > aggregations of some kind. Since you mention spdep below, I'm assuming > that the data you are working on refer to "spatial entities", for which > Moran's I would be a reasonable choice of test. If the variable of > interest isn't of this form, then other packages are more relevant (see R > spatial projects link below). > > > Up to this point I have been exploring the "spdep" package and I can get > > "moran.test" to work, but I am concerned that somewhere along the line I > > may not be doing things correctly. Hence my request for a tutorial so > > that I may brush up on my autocorrelation basics, specifically > > autocorrelation with R, and reassure myself that the results I am > > getting aren't bogus. > > Admittedly, the help page for moran.test() simply refers to Cliff, A. D., > Ord, J. K. 1981 Spatial processes, Pion, p. 21 as the original source, and > the "sids" vignette (see the foot of the output of help(package=spdep) to > locate it on your system) is incomplete. My guess is however that if your > data are for "spatial entities", theb constructing a sensible > neighbour weights is at least 75% of the work - you will also see this in > Virgilio G??mez-Rubio's "DCluster" package, and the existing "sids" > vignette does cover that a little. Completing and improving this vignette > is on my TODO list. > > If you are unsure of the result, and want to stay within the R framework, > consider calculating Moran's I using DCluster, or gearymoran() in "ade4". > Beyond that, you could access the GeoDa software (Windows, not R) and > documentation at http://sal.agecon.uiuc.edu/csiss/geoda.html, the site > also housing the R spatial projects web pages: > > http://agec221.agecon.uiuc.edu/csiss/Rgeo/ > > Please contact me off-list, or on the R-sig-geo list if you feel that > would help. > > Best wishes, > > Roger Bivand > > > > > Thanks in advance for any suggestions! > > > > Jeff Hollister > > > > ***************************************************** > > Jeffrey William Hollister > > Ph.D. Candidate > > Environmental Data Center > > Department of Natural Resources Science > > University of Rhode Island > > office: (401) 874 5054 > > fax: (401) 874 4561 > > cell: (401)556 4087 > > http://www.edc.uri.edu/personal/jeff/home/jwh_cv_full.htm > > > > ______________________________________________ > > R-help at 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 > > > > -- > Roger Bivand > Economic Geography Section, Department of Economics, Norwegian School of > Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, > Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 > e-mail: Roger.Bivand at nhh.no > > > > ------------------------------ > > Message: 112 > Date: Fri, 27 Aug 2004 10:32:46 +0100 > From: Patrick Burns <pburns at pburns.seanet.com> > Subject: Re: [R] Surprise when mapping matrix to image > To: Peter Dalgaard <p.dalgaard at biostat.ku.dk> > Cc: r-help at stat.math.ethz.ch > Message-ID: <412EFFBE.6030703 at pburns.seanet.com> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > > > Peter Dalgaard wrote: > > >"Richard A. O'Keefe" <ok at cs.otago.ac.nz> writes: > > > > > [snip] > > > > > > > > >Good idea, but perhaps not phrased sharply enough to catch the user's > >eye. How about something like this: > > > >"Notice that image() interprets a matrix as a table of f(x_i, y_j), so > >the x axis corresponds to row number and the y axis to column number > >(bottom to top)." > > > >and then use Brian's one-liner in the examples section? > > > > > > Though I think the added text is a good idea, the addition of the example > is probably 102.58 times more useful than any text that could be inserted. > > The examples in help files are probably the main reason that people think > of R having better documentation than other programs. Like Unix man > pages, for example, which would be wonderful if only they had examples > so that you could figure out what the sentences mean when you understand > every word. > > Patrick Burns > > Burns Statistics > patrick at burns-stat.com > +44 (0)20 8525 0696 > http://www.burns-stat.com > (home of S Poetry and "A Guide for the Unwilling S User") > > > > ------------------------------ > > Message: 113 > Date: 27 Aug 2004 11:35:14 +0200 > From: Peter Dalgaard <p.dalgaard at biostat.ku.dk> > Subject: Re: [R] Surprise when mapping matrix to image > To: Patrick Burns <pburns at pburns.seanet.com> > Cc: r-help at stat.math.ethz.ch, Peter Dalgaard > <p.dalgaard at biostat.ku.dk> > Message-ID: <x2pt5crkj1.fsf at biostat.ku.dk> > Content-Type: text/plain; charset=us-ascii > > Patrick Burns <pburns at pburns.seanet.com> writes: > > > Peter Dalgaard wrote: > > > > >"Richard A. O'Keefe" <ok at cs.otago.ac.nz> writes: > > > > > [snip] > > > > > Good idea, but perhaps not phrased sharply enough to catch the > > > user's > > >eye. How about something like this: > > > > > >"Notice that image() interprets a matrix as a table of f(x_i, y_j), so > > >the x axis corresponds to row number and the y axis to column number > > >(bottom to top)." > > > > > >and then use Brian's one-liner in the examples section? > > > > > > > Though I think the added text is a good idea, the addition of the example > > is probably 102.58 times more useful than any text that could be inserted. > > > > The examples in help files are probably the main reason that people think > > of R having better documentation than other programs. Like Unix man > > pages, for example, which would be wonderful if only they had examples > > so that you could figure out what the sentences mean when you understand > > every word. > > There are limits, I think. If you put too many variations into the > example section, it tends to become a grey blob of code. Anyways, I'm > going to add both. > > -- > O__ ---- Peter Dalgaard Blegdamsvej 3 > c/ /'_ --- Dept. of Biostatistics 2200 Cph. N > (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 > ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 > > > > ------------------------------ > > _______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE read the posting guide! http://www.R-project.org/posting-guide.html > > > End of R-help Digest, Vol 18, Issue 27 > **************************************
James W. MacDonald
2004-Aug-27 17:32 UTC
[R] selecting unique columns of a matrix/data frame
Stephen Nyangoma wrote:> Hi all, > I have a very high dimensional data and apparently there are several > columns that contain similar information (some columns are equal). I > want to form a matrix/data frame consisting of unique columns. Does > anyone have an efficient way of getting out these columns. A small > section of the data frame is given below. > > Thanks for helping. > > Stephen.?unique -- James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109
Reasonably Related Threads
- text() with text, variables and math HOWTO?
- log(0) error is not handled in xyplot, Windows
- bug in nlme package function predict.lmList (PR#13788)
- Thanks! (was panel.axis() & grid/lattice settings)
- problem with gls finding model terms without specifying data=named.object