Re: [R] combinations/ indexing a matrix

2010-03-11 Thread RICHARD M. HEIBERGER
res - combn(4,2) result - LETTERS[res] dim(result) - dim(res) result ## Rich [[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

Re: [R] NAs and row/column calculations

2010-03-11 Thread RICHARD M. HEIBERGER
Jim, The next step for understanding what happens is to subset a complicated expression and see what its sub-pieces are doing. Since apply(a[!is.na(a)],2,sum) doesn't work, start by looking at each of the arguments to apply. You already verified that !is.na(a) gives what you want. Now take

Re: [R] Plot interaction in multilevel model

2010-03-06 Thread RICHARD M. HEIBERGER
## dadrivr dadr...@gmail.com ## I suggest a lattice plot of all two-way interactions on the ## off-diagonals and all marginal main effects on the main diagonal. ## Please install HH and then ?interaction2wt for some examples. ## install.packages(HH) ## if you don't already have it library(HH)

Re: [R] About the interaction A:B

2010-03-05 Thread RICHARD M. HEIBERGER
On Fri, Mar 5, 2010 at 12:41 PM, Jeff Laake jeff.la...@noaa.gov wrote: On 3/5/2010 9:19 AM, Frank E Harrell Jr wrote: You neglected to state your name and affiliation, and your question demonstrates an allergy to R documentation. A:B indicates a two-level naming scheme. The naming is

Re: [R] Emacs for R

2010-03-01 Thread RICHARD M. HEIBERGER
so if I ran an R command that took a long while to complete, I couldn't switch back to my source buffer and keep messing around with my code while the R process was doing whatever it was doing. Normally Ctrl-G gives control back to you while the R process is still running.

Re: [R] two questions for R beginners

2010-03-01 Thread RICHARD M. HEIBERGER
I would love to see a text oriented towards someone who has never used anything but Excel, but realizes that to do science today you have to go beyond the Data analysis toolbar from Excel. (Plese tell me if you know of any) Best to all, Keo. Please look at *R through Excel, *the book that Erich

Re: [R] simple main effect.

2010-02-27 Thread RICHARD M. HEIBERGER
Lets take for example an experiment in which I had two between subject variables - Strain and treatment, and one within - exposure. all the variables had 2 levels each. I found an interaction between exposure and Strain and I want to compare Strain A and B under every exposure (first and

Re: [R] two questions for R beginners

2010-02-25 Thread RICHARD M. HEIBERGER
statistics book. I recommend mine Statistical Analysis and Data Display, An Intermediate Course with Examples in S-Plus, R, and SAS, Richard M. Heiberger and Burt Holland, Springer 2004 But I will acknowledge that other books are available. Rich __ R

Re: [R] TukeyHSD troubles

2010-02-25 Thread RICHARD M. HEIBERGER
treat_code is a dummy variable, but that shouldn't matter.  Any suggestions? It does matter to TukeyHSD. If treat_code is a numeric variable with discrete values 0 and 1, then it does not have class factor. It is true that aov will give the same ANOVA table for a two-level factor as for a

Re: [R] export tables to Excel files

2010-02-23 Thread RICHARD M. HEIBERGER
Please consider RExcel, which allows complete integration of R and Excel. See http://rcom.univie.ac.at for details and examples including a video. RExcel works in both directions (R to Excel, Excel to R) with Excel 2010, 2007, 2003, and 2002. Rich [[alternative HTML version deleted]]

Re: [R] Short cut for documenting arguments in Rd file

2010-02-22 Thread RICHARD M. HEIBERGER
Frank, you can collect multiple arguments into a single \item{} You example simplified becomes \item{x, y, contrasts}{see \code{\link{glm}}} Rich [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] LaTeX/R/Sweave Problems

2010-02-20 Thread RICHARD M. HEIBERGER
To overcome the fact that the R installation had spaces in the path, The easiest way to deal with spaces is to use the 8.3 names in your paths. From the DOS CMD window, enter dir /x and you will get the 8.3 names. For example dir /x/ad c:\pr* cd c:\progra~1\R dir /x/ad R-2.10.* Based

Re: [R] Graphics Question

2010-02-18 Thread RICHARD M. HEIBERGER
## The grouped boxplot is one of the features included in the HH package. ## You will need to install HH if you do not yet have the HH package ## A similar example is posted on my website ##http://astro.ocis.temple.edu/~rmh/HH/bwplot-color.pdf ## This is fake data which I hope mimics the

Re: [R] Deleting colmuns with 0's and also writing multple csv files

2010-02-18 Thread RICHARD M. HEIBERGER
(2)  Suppose I have variable no of datasets 'say n = 10'. I wish to write a loop assigning each of these datasets to diffrent csv files e.g. for (i in 1:10)  { write.csv(data.frame(dataset[,,i]), 'data_set[i].csv', row.names = FALSE)  } The result of this command is generation of a csv

Re: [R] Split Plot and Tukey

2010-02-17 Thread RICHARD M. HEIBERGER
Please look at the maiz example, the last example in ?MMC in the HH package, to see how to display pairwiuse contrasts in split-plot experiments. Look at the entire example, all the way to the end of the help file. Rich __ R-help@r-project.org mailing

Re: [R] qr test?

2010-02-17 Thread RICHARD M. HEIBERGER
Your results show that you have a rank 2 matrix. $rank [1] 2 Therefore the third column of Q for your x is arbitrary. A better example would be x - matrix(rnorm(12), 4, 3) qr(x) Rich __ R-help@r-project.org mailing list

Re: [R] print() / split()

2010-02-11 Thread RICHARD M. HEIBERGER
This is defined in the help file ?print.trellis __ 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,

Re: [R] Interpretation of high order interaction terms.

2010-02-09 Thread RICHARD M. HEIBERGER
## Artificial data with all interactions significant. ## The interaction2wt plot shows all main effects and all pairwise ## interactions. We see in the Y ~ A|B panel (or in the ## interaction.plot) that Y goes uphill for levels 1 and 2 of B and ## goes down and then up for level 3 of B. This is

Re: [R] Interpretation of high order interaction terms.

2010-02-09 Thread RICHARD M. HEIBERGER
## Continuing with the same example, I now show the full set of contrasts and their ## associated regression coefficients. Remember that regression coefficients in ## models with factors are meaningful only when the dummy variables are also displayed. ## construct full set of dummy variables to

Re: [R] Noval numbers

2010-02-07 Thread RICHARD M. HEIBERGER
, shillings, pence), and for unique indexing of cells in designed experiments. Rich ## base ## Richard M. Heiberger ## See Section 12.1.4.2 of ## Richard M. Heiberger ## Computation for the Analysis of Designed Experiments ## Wiley, 1989 ## defaults to 8 bit binary base - function(x, basis=c

Re: [R] split plot with aov

2010-02-07 Thread RICHARD M. HEIBERGER
The dummy variables for the factors in balanced designs are orthogonal. The treatment dummy variables are not orthogonal to the block dummy variables for unbalanced designs. That is essentially what the term balanced means. __ R-help@r-project.org

Re: [R] lattice barchart using a time scale in x axis

2010-02-05 Thread RICHARD M. HEIBERGER
Fran, The trick is to use box.width, not box.ratio. xyplot(Perc ~ as.POSIXct(hora,format=%d-%m-%Y %H:%M), data=digrate, groups=Drate, ## key=leg, xlab=time of the day, horizontal=FALSE, scales=list(alternating=FALSE, tck=c(1,0),

Re: [R] Importing data coming from Splus into R.

2010-02-05 Thread RICHARD M. HEIBERGER
Have you tried dput/dget or dump/source? On the S-Plus side, you need to tell it to use the older format. Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] lattice barchart using a time scale in x axis

2010-02-04 Thread RICHARD M. HEIBERGER
SCript with xyplot: xyplot(Perc~as.POSIXct(hora,format=%d-%m-%Y %H:%M),digrate,groups=digrate$Drate,key=leg,xlab=time of the day, scales=list(alternating=F,tck=c(1,0),x=list(at=seq(r[1],r[2],by=hour),labels=format(seq(r[1],r[2],hours),format=%H:%M))),            

Re: [R] xyplot 3 panels 3 different Y variables

2010-02-04 Thread RICHARD M. HEIBERGER
Continuing from your JUNK example: xyplot(Creatinine + Estrogen + Ratio ~ Day, data=JUNK, type=l, outer=TRUE, layout=c(1,3), scales=list(y=list(relation=free))) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] How do I use tapply in this case ?

2010-02-04 Thread RICHARD M. HEIBERGER
lapply(1:4, function(i, x, y) {x[i,y[,1]]}, Z, index ) ## reproduces your results sapply(1:4, function(i, x, y) {x[i,y[,1]]}, Z, index ) ## collapses your list into a set of columns __ R-help@r-project.org mailing list

Re: [R] Problem accessing help files

2010-02-03 Thread RICHARD M. HEIBERGER
In addition to Marc's comments, you might want to use setInternet2() I am pretty sure this will get you past a firewall to r-project.org. I think it might also get you access to 127.0.0.1. Access to 127.0.0.1 is not explicitly mentioned in the help file ?setInternet2 Rich

Re: [R] Problem accessing help files

2010-02-03 Thread RICHARD M. HEIBERGER
If you paste http://127.0.0.1:12300/library/base/html/sum.html directly into an IE window, will it find it? You need to do that after the attempt fails in order to get the right port number for the current instance. __ R-help@r-project.org mailing

Re: [R] combining data frames in a list - how do I add breaks?

2010-01-31 Thread RICHARD M. HEIBERGER
I have several questions on your goals. Why are you planning to post-processing outside of R? Why use CSV files when there are usually better ways to maintain the structure of the data? Why do you want to flatten your tables? It looks like a three-dimensional array would better capture the

Re: [R] RV: Rattle not reading files on windows 7

2010-01-28 Thread RICHARD M. HEIBERGER
The message you are getting is unrelated to reading files. That probably means you have loaded a previous work file that is masking something. Type conflicts(detail=TRUE) If that doesn't give you the answer, then try closing R entirely and start a new session from START Run

Re: [R] Executing a R-string

2010-01-27 Thread RICHARD M. HEIBERGER
m - c(1,4,2,3,7,5) S - which(m==4) P - parse(text=S) R - eval(P) R Before you do this, see fortune(106) fortune(106) If the answer is parse() you should usually rethink the question. -- Thomas Lumley R-help (February 2005) On Wed, Jan 27, 2010 at 8:59 AM, Joe Trubisz jtrub...@mac.com

Re: [R] barchart with stacked and beside bars

2010-01-21 Thread RICHARD M. HEIBERGER
## There are at least two options, one using mosaic and the other using barchart. ## Here are both. ## this is your data ld-matrix(c(25,25,50,10,30,60,15,35,50,30,30,40),nrow=4,byrow=T) ntreat2-c(n0,n96,n0,n96) rownames(ld)-ntreat2 typ-c(gr,fo,le) colnames(ld)-typ ## now some rearrangements

Re: [R] barchart with stacked and beside bars

2010-01-20 Thread RICHARD M. HEIBERGER
I don't understand what you are looking for. The line barplot(t(ld)) is placing the four treatments side by side, and is also stacking the three values of typ. Please indicate what you would like the figure to look like. Rich __

Re: [R] anova

2009-12-28 Thread Richard M. Heiberger
You may need to look at some other contrasts than the pairwise. For example, 3(x.bar_A + x.bar_B) - 2(x.bar_C + x.bar_D + x.bar_E) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Plot odds ratios on log scale

2009-12-21 Thread Richard M. Heiberger
Please look at the aedotplot, in which we plot four variables: A effect, B effect, relative risk, and CI on the relative risk. It should be easily modified to plot the odds ratios. ## install.packages(HH) ## if you don't have it yet. library(aedotplot) example(aedotplot)

Re: [R] simple main effect.

2009-12-20 Thread Richard M. Heiberger
For simple effects in the presence of interaction there are several options included in the HH package. If you don't already have the HH package, you can get it with install.packages(HH) Graphically, you can plot them with the function interaction2wt(..., simple=TRUE) See the examples in

Re: [R] Lattice boxplots

2009-12-19 Thread Richard M. Heiberger
The grouped boxplot is one of the features included in the HH package. An example is posted on my site http://astro.ocis.temple.edu/~rmh/HH/bwplot-color.pdf See also the R-help email with an example vaguely similar to yours: https://stat.ethz.ch/pipermail/r-help/2009-March/190541.html

Re: [R] Lattice boxplots

2009-12-19 Thread Richard M. Heiberger
All the examples have the code file that generate them listed in the captions. The specific panel function that is usually used is panel.bwplot.intermediate.hh __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] lattice: adding information on number of observations

2009-12-02 Thread RICHARD M. HEIBERGER
The boxplot with sample size information is one of the features included in the HH package. An example is posted on my site http://astro.ocis.temple.edu/~rmh/HH/bwplot-color.pdf In this example I show grouping, control of x-axis position, multiple x-axis labels, and control of display of extreme

Re: [R] Grouped Boxplot

2009-11-26 Thread Richard M. Heiberger
The grouped boxplot is one of the features included in the HH package. An example is posted on my site http://astro.ocis.temple.edu/~rmh/HH/bwplot-color.pdf Reconstructing Figure 3 in your file GroupedBoxplot.pdf from your 11/24/2009 10:35 AM email would be easy.

Re: [R] Plotting Stacked Bar

2009-11-25 Thread Richard M. Heiberger
## Your original data is already the result of table(). ## Here are two versions, one using barchart and one barplot. tmpc - textConnection( Month Core(%) Non_core(%) 1 4555 2 4852 3 3664 4

Re: [R] how do i persuade IT to install R on PCs ?? ...and should I ??

2009-11-22 Thread RICHARD M. HEIBERGER
Please also look at the R document http://www.r-project.org/doc/R-FDA.pdf and ask your IT department to read this document Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] how to prevent lattic barchart from drawing bar completely to the bottom/left of the chart

2009-11-22 Thread RICHARD M. HEIBERGER
?panel.barchart use the argument origin=0 __ 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,

[R] change in behavior of contrasts for ordered factors

2009-11-22 Thread RICHARD M. HEIBERGER
The row names are not constructed in 2.10.0pat. Is this change intentional? I am using Windows. R version 2.10.0 Patched (2009-11-09 r50375) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 contrasts(ordered(LETTERS[1:4])) contrasts(ordered(LETTERS[1:4]))

Re: [R] question about how to generate an orthogonal matrix with a known vector

2009-11-22 Thread RICHARD M. HEIBERGER
## You can do this with the qr functions. tmp - rnorm(4) tmp.qr - qr(tmp) tmp.complete - qr.Q(tmp.qr, complete=TRUE) tmp.complete[,1] / tmp __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] Help with multiple comparisons on a 2-way repeated measures ANOVA

2009-11-20 Thread Richard M. Heiberger
install.packages(HH) library(HH) ?MMC Go to the bottom of the page and read the maiz example. Read through the example that shows aovlist objects don't work and how to construct the equivalent aov object. __ R-help@r-project.org mailing list

Re: [R] Stacked Bar Plot

2009-11-20 Thread RICHARD M. HEIBERGER
tmp - cbind(x=c(1,-.2,.3,.4), y=c(.5,.6,-.7,.8)) row.names(tmp) - letters[1:4] barchart(tmp, horizontal=FALSE, stack=TRUE, auto.key=list( title=pollutant, border=TRUE), xlab=Month, main=Interesting Plot) barchart(tmp,

Re: [R] person-level to person-period xfm

2009-11-19 Thread Richard M. Heiberger
Robert Terwilliger wrote: Dear R experts, I have a so-called person-level data frame that I need to transform into a person-period data frame. If the lingo is unclear, the data have one row for each subject, with repeated measures data each in a separate column. I need to transform these data

Re: [R] 2 functions in xyplot

2009-11-19 Thread RICHARD M. HEIBERGER
Unexpected symbol often means missing punctuation. In this case, it looks like panel=function(){panel.xyplot(Kalibrierung$Spannung,Kalibrierung $Magnetfeld)panel.abline(reg=test)} this argument is missing a semi-colon ; before panel.abline.

Re: [R] question about the lattice package

2009-11-13 Thread RICHARD M. HEIBERGER
The first step is to make Weather a factor. Then the levels would be displayed in the strip labels. The second step would be to change the level values to the actual strings you want to see. tmp - data.frame(Weather=1:3, x=rnorm(3), y=rnorm(3)) xyplot(y ~ x | Weather, data=tmp) tmp$Weather -

Re: [R] barplot at specific x values

2009-11-12 Thread Richard M. Heiberger
Bastian Pöschl wrote: Dear useRs, I search for a possibillity to plot stacked bars at specific x positions. I tried and tried, but the only way i got something adequate was by using lowlevel plots segments(). That is quiet ok, but will not please eyes without a lot of par() lines.

Re: [R] Suppressing final spaces in data.frame printouts

2009-11-11 Thread Richard M. Heiberger
Stavros Macrakis wrote: I could of course write my own print function for this, but was wondering if there was a standard way of doing it. If not in R, perhaps there is some way to have ESS delete the final spaces? ESS, or more precisely emacs, can handle that. Use the M-x

Re: [R] Suppressing final spaces in data.frame printouts

2009-11-11 Thread RICHARD M. HEIBERGER
On Wed, Nov 11, 2009 at 8:12 PM, Stavros Macrakis macra...@alum.mit.edu wrote: Thanks for the suggestion. I'mm familiar with the truncate-lines variable, but that's not quite what I was looking for. I don't want the padding spaces displayed, but I do want to see long strings at the end of the

Re: [R] Newbie question Multcomp

2009-11-05 Thread Richard M. Heiberger
qwe84 wrote: Hello, I'm a totally newbie to R and I'm taking a class using S+. In the class we use the multcomp command which takes a aov object and calculates confidence intervals for all pairwise differences by the Fisher least significant differences method. How can I do this in R. Thank

Re: [R] Multiple comparison test split plot analysis in R

2009-10-26 Thread Richard M. Heiberger
Please see the maiz example in ?HH:::glht.mmc You may need to install HH first with install.packages(HH) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Help with history() in Emacs/ESS

2009-10-25 Thread Richard M. Heiberger
Lines sent to R by C-c C-n and related commands are excluded from the R history. They appear only in the ESS history. This, along with everything else, is documented in the file /ess/doc/html/ess.html Questions on ESS should be sent to the ESS list ess-h...@stat.math.ethz.ch Rich

Re: [R] Implementation of gamma function for large number

2009-10-24 Thread Richard M. Heiberger
Use the lgamma function. log(gamma(170)) [1] 701.4373 lgamma(170) [1] 701.4373 In typical uses of gamma(), they are multiplied or divided by other gamma() values, bringing the final result into the range of double precision numbers. Also, look at beta(), which does those divisions of

Re: [R] editors for R

2009-10-20 Thread Richard M. Heiberger
ESS does everything you requested. ess.r-project.org ess-remote is the specific feature that allows you to run a program on another computer from within a buffer on the local computer. Rich __ R-help@r-project.org mailing list

Re: [R] TukeyHSD no longer working with aov output?

2009-10-20 Thread Richard M. Heiberger
I think its a problem with my data, something about how Rexcel imported it We don't have enough information to be sure. My guess is that your data in Excel is integers which are intended to be levels of a factor. Excel doesn't distinguish between integers and integers that might be factor

Re: [R] TukeyHSD no longer working with aov output?

2009-10-20 Thread Richard M. Heiberger
Now I am worried that you have a wrong analysis. the aov function is perfectly happy using either factors or numeric variables. Are there really only two levels of time, which is what one degree of freedom for time suggests? Or are there more than two level, but since aov() sees that as a

Re: [R] rbind to array members‏

2009-10-19 Thread RICHARD M. HEIBERGER
       z - abind(x[,,1], c(4,5,6),along=0) z is probably not what you want because you aren't using the drop=FALSE argument. See the FAQ 7.5 abind, and arrays in general, are rectangular solids. They are not ragged. For that you need lists. To get something like your request x , , 1    

Re: [R] rbind to array members

2009-10-18 Thread Richard M. Heiberger
library(abind) ## array binding __ 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

Re: [R] Why points() is defined specially for a 1 by 2 matrix?

2009-10-18 Thread Richard M. Heiberger
points(x[4,],pch=2)# this is plotted as two points drops what it sees as an unnecessary dimension. Use points(x[4,, drop=FALSE], pch=2) See FAQ 7.5 tmp - matrix(1:2) tmp tmp[,1] tmp[,1,drop=FALSE] __ R-help@r-project.org mailing list

Re: [R] help: combine multiple 'pairs plots'

2009-10-15 Thread Richard M. Heiberger
Jesse Poland wrote: I would like to combine multiple pairs plots (each one being a matrix of correlation plots) into a single graphic. I have tried the par() function, which works well to combine several simple graphs. However, the pairs() graph seems to override the par() function and produce

Re: [R] reference on fisher.test()

2009-10-15 Thread RICHARD M. HEIBERGER
On Thu, Oct 15, 2009 at 4:56 PM, Peng Yu pengyu...@gmail.com wrote: Can somebody point me a book on Fisher's exact test? I looked a few webpages. But the descriptions on the webpages are not very complete. Is there a book on that covers all the aspect of Fisher's exact test that is implemented

Re: [R] communication of R Programs

2009-10-07 Thread Richard M. Heiberger
I don't understand the context of the question. Since the data is already in R, you should use it from within R. What is the reason for translating it to XML and then back? You take the risk of two levels of distortion. I am guessing that you want continuity of your work over multiple login

Re: [R] Plotting 1 covariate, 3 factors

2009-10-07 Thread Richard M. Heiberger
## Paul ## I think you are looking for interaction2wt y - rnorm(36) f1 - rep(c(after, before), 18) f2 - rep(1:3, 12) f3 - rep(1:2, each=18) ## your definition of ff was faulty. It gave a constant. f3.f1 - interaction(f3, f1) interaction.plot(f3.f1, f2, y) f2 - factor(f2) f3 - factor(f3) ##

Re: [R] Make a blank dataframe with given dimensions

2009-10-07 Thread Richard M. Heiberger
tmp - data.frame(matrix(nrow=0, ncol=32)) tmp [1] X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 [20] X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 X32 0 rows (or 0-length row.names) names(tmp) - c(letters, LETTERS[1:6]) tmp [1] a b c d e f g h i j k l m n o p

[R] boundary situation that caught me by surprise

2009-10-05 Thread RICHARD M. HEIBERGER
tmp2 - matrix(1:8,4,2) dimnames(tmp2) NULL tmp2 [,1] [,2] [1,]15 [2,]26 [3,]37 [4,]48 dimnames(tmp2)[[2]] - c(a,b) tmp2 a b [1,] 1 5 [2,] 2 6 [3,] 3 7 [4,] 4 8 tmp1 - matrix(1:4,4,1) dimnames(tmp1) NULL tmp1 [,1] [1,]1 [2,]2 [3,]3

Re: [R] Color of the plot which correspond to the group of the observations

2009-09-24 Thread Richard M. Heiberger
It is easier in lattice dp - c(1,4,3,2,5,7,9,8,9,2) tp - 1:10 gg - rep(1:3, c(3,3,4)) ddff - data.frame(dp=dp, tp=tp, gg=gg) xyplot(dp ~ tp, groups=gg, data=ddff) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread RICHARD M. HEIBERGER
If you are starting with an Excel file, then you should have R read the xls file directly. You should avoid the distortions often introduced by an intermediate format such as .txt or .csv files. I recommend using RExcel. You can get it from CRAN with install.packages(RExcelInstaller)

Re: [R] Emacs and ESS help

2009-09-18 Thread Richard M. Heiberger
See the documentation for ESS in the ESS distribution ess/doc/html/readme.html There is even more detail in ess/doc/html/ess.html For the specific question about the emacs initialization file ~/.emacs, that file is in your home directory which emacs will find. The ~ abbreviation is required

Re: [R] How can I replicate Excel's 'growth trend' series interpolation?

2009-09-16 Thread Richard M. Heiberger
exp(seq(log(1.4), log(30), length=11)) [1] 1.40 1.902074 2.584203 3.510961 4.770076 6.480741 8.804891 11.962537 16.252591 22.081162 [11] 30.00 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] Collecting data in a data structure

2009-09-16 Thread Richard M. Heiberger
There are two issues here. The specifics of the error message are because you declared a data.frame with 0 columns and then attempted to change two columns. data.frame() data frame with 0 columns and 0 rows q - data.frame() q[1,] - data.frame(a=3, b=6) Warning in `[-.data.frame`(`*tmp*`, 1,

Re: [R] abind, but on lists?

2009-09-03 Thread Richard M. Heiberger
Peter, Thank you for the dput values. Kenn points out that result - cbind(data1[,,1], data2[,,1]) dim(result) - c(3,3,1) gets what you want. We wrote abind to bind atomic arrays and/or data.frames. The list feature, which is interfering with your usage, was designed to simplify calling

Re: [R] abind, but on lists?

2009-09-02 Thread Richard M. Heiberger
Almost certainly, abind is what you need for the task. Please dput() your matlab objects and send that to the list. That will make your example reproducible. Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Google style

2009-08-31 Thread RICHARD M. HEIBERGER
This is where a good editor with proper syntactic indentation is helpful. The first example is Terry's function as indented by ESS. It is very clear that there are two lines with parallel indentation. zed - function(x,y,z) { x + y +z; } The second function is modified to place the + on the

Re: [R] RE xcel - two problems - Running RExcel Working Directory error

2009-08-30 Thread Richard M. Heiberger
1. The embedded blanks often cause problems. Try the 8.3 version of the filepath. To find the 8.3 name, open an MSDOS cmd window and enter dir /x 'C:\\Raoul\\R There will be a line something like RMAPS_~1 R Maps_UK Maps_Test Use the value that appears in the RMAPS_~1 position. 2. try

Re: [R] ANCOVA with defined error terms

2009-08-23 Thread Richard M. Heiberger
Ok, now we can talk. 1. covariates: coon Your model specification put coon sequentially last, effectively testing the hypothesis that the slope associated with coon, after adjusting for all the factors, is zero. My model place coon sequentially first, effectively testing the hypotheses that

Re: [R] ANCOVA with defined error terms

2009-08-22 Thread Richard M. Heiberger
The three-way interactions you mention are included in the model formula I suggested. If they didn't appear in the expansion, it suggests that you have some aliasing due to empty cells. I can't do any more without your dataset. You can post your dataset with random response values. The exact

Re: [R] ANCOVA with defined error terms

2009-08-22 Thread Richard M. Heiberger
Your email program truncated the model. It would not run, hence was not reproducible. The last few characters of the first line are +Error(block/plot, which is syntactically impossible because there is no closing parenthesis before the comma. Try executing your email and see the difficulty.

Re: [R] ANCOVA with defined error terms

2009-08-22 Thread Richard M. Heiberger
Your model formula cannot be correct. The phrase Error(block/plot, data = track) is wrong. It has to be something like this Error(block/plot), data = track The Error function requires a well-defined formula. The , character cannot be inside the Error function. You misunderstood my use of

Re: [R] ANCOVA with defined error terms

2009-08-20 Thread Richard M. Heiberger
Yes, I meant summary(). anova() isn't defined for aovlist objects and summary() is. Warning message: In aov(kotz.mice ~ kotz.coon + block * veget * fruit * time - block:veget:fruit:time + : Error() model is singular You will need to investigate the singular Error() model. You might

Re: [R] ANCOVA with defined error terms

2009-08-19 Thread Richard M. Heiberger
track.aov - aov(mice ~ coon + block*veget*fruit*time - block:veget:fruit:time + Error(block/plot), data = track) anova(track.aov) I think this is what you are looking for. This model in words says, What is the effect of the four-way crossing after adjusting

Re: [R] Split plot analysis problems

2009-07-22 Thread Richard M. Heiberger
Jean-Paul Maalouf wrote: Do you have any idea on how can I verify preliminary assumptions in this model (normality of the residuals and variance homogeneity), since R is not able to extract residuals? Of course, R extracts residuals. Use the proj() function. See ?proj for the example to

Re: [R] superimpose multiple scatterplot matrices

2009-07-02 Thread Richard M. Heiberger
Ping-Hsun Hsieh wrote: Dear R- experts, I am trying to superimpose two or more scatterplot matrices generated by pairs() to visualize the differences over each datasets, but have not been very successful. Two data frames, df1 and df2 for example, each has the same five variables in

Re: [R] sum of list elements

2009-07-02 Thread Richard M. Heiberger
I think you are asking for Reduce Reduce(`+`, a) [,1] [,2] [,3] [1,]300 [2,]030 [3,]003 You might be asking for do.call with some function's name as its first argument. do.call(sum, a) [1] 9 __

Re: [R] ANOVA with means and SDs as input

2009-06-25 Thread Richard M. Heiberger
Look at the anova.mean function in the HH package. It does what you are asking, although limited to one-way ANOVA. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Boxplots: side-by-side

2009-06-24 Thread Richard M. Heiberger
Try this Rich tmp - data.frame( y=rnorm(100), category=rep(factor(letters[1:5]),each=20), level=rep(factor(0:1), length=100)) tmp table(tmp[,2:3]) tmp$y[with(tmp, category==a level=0)] - NA tmp$y[with(tmp, category==a level==0)] - NA tmp$y[with(tmp, category==e level==1)] - NA tmp$y[78:80]

Re: [R] a plot of stacked boxes

2009-06-19 Thread Richard M. Heiberger
I think you are looking for mosaic() table(df) library(vcd) mosaic(outcome ~ group, data=df) Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] off topic but need your pointers about statistics

2009-06-18 Thread Richard M. Heiberger
Alan Izenman suggests: I have lots of places worth checking out for him. It means a lot of reading. Probably the first (and best) place to start is the set of Springer books entitled Breakthroughs in Statistics, which was edited by Kotz Johnson. There' are three (3) volumes:

Re: [R] function output with for loop and if statement

2009-04-23 Thread Richard M. Heiberger
tmp.out.sort - tmp.out[, order(names(tmp.out))] tmp.out.sort - tmp.out[, order(names(tmp.out)), drop=FALSE] From your description of misbehavior with a single column, I think the drop=FALSE argument will provide the protection you need. Then you will not need the if clause. See ?`[.data.frame`

Re: [R] Finding determinants of x-loaded matrix?

2009-03-20 Thread Richard M. Heiberger
This is an eigenvalue problem with 0 on the main diagonal. It is almost always inefficient to find the determinant as an intermediate step. The original poster is looking for the ngative of the eigenvalues of the matrix with the x replaced by zeros. tmp -

Re: [R] Grouped Boxplot

2009-03-04 Thread Richard M. Heiberger
## you may need to ## install.packages(HH) library(HH) tmp - data.frame(y=rnorm(500), g=rep.int(c(A, B, C, D), 125), a=factor(rbinom(500, 1, .5))) bwplot(y ~ g | a, data=tmp) bwplot(y ~ a | g, data=tmp) tmp$ga - with(tmp, interaction(a, g))

Re: [R] repost: problems with lm for nested fixed-factor Anova (ANOVA I)

2009-02-12 Thread Richard M. Heiberger
tmp - data.frame(y=rnorm(15000), x1 - factor(sample(48, 15000, replace=TRUE)), z1 - factor(sample(242, 15000, replace=TRUE))) system.time( tmp.aov - aov(y ~ x1/z1, data=tmp) ) ## exceeds memory tmp2 - data.frame(y=rnorm(15000),

Re: [R] Orthogonal Complement

2009-01-11 Thread Richard M. Heiberger
Yes, download the HH package from CRAN and then see ?HH::orthog.complete for the function description and several examples. Rich -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of megh Sent: Sunday, January 11, 2009 19:29 To:

Re: [R] Contrast SS

2008-11-28 Thread Richard M. Heiberger
I believe you are looking for the summary.lm() function and its split= argument. Look at example(summary.aov) for several examples. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] birthday problem (factorial limit)---fortune candidate

2008-11-15 Thread Richard M. Heiberger
The function ... works for different values of two Thomas Lumley __ 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] Reconstruct the Q matrix from the QR object

2008-10-29 Thread Richard M. Heiberger
x - matrix(rnorm(1:20), 5, 4) x.qr - qr(x) Q - qr.Q(x.qr) R - qr.R(x.qr) X - qr.X(x.qr) Q R X Q %*% R qr.Q(x.qr, complete=TRUE) ## orthogonal completion __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Dot plot - equivalent of MINITAB

2008-09-26 Thread Richard M. Heiberger
I suggest the panel.dotplot.tb in the HH package. It is a lattice panel function and therefore works with standard trellis formulas including conditioning variables and grouping variables. library(HH) example(panel.dotplot.tb) Since you define what you want in terms of Minitab, I mention that

<    3   4   5   6   7   8   9   >