Re: [R] List of arrays - problem with dimensions

2012-10-28 Thread Richard M. Heiberger
Your example is hard to understand because it includes multiple copies of the number "1". Let me do something with different values and see if it gets what you are after. Your code as posted can't work because the variable n is not defined. result <- list(a=array(1:48, dim=c(2,2,3,4)),

Re: [R] List of multidimensional arrays

2012-10-25 Thread Richard M. Heiberger
You are very lucky. This question was answered last week in https://stat.ethz.ch/pipermail/r-help/2012-October/326597.html For the future, please read the posting guide referenced below and include an example of your data and the result of the calculation you would like to see. Please use R-help

Re: [R] List of multidimensional arrays

2012-10-25 Thread Richard M. Heiberger
"fy"), row.names = c(NA, -55L), class = "data.frame") > Now the reader can pick up the "mydata <- " lines and paste them into the R session and reproduce what you want us to see. On Thu, Oct 25, 2012 at 9:53 AM, Richard M. Heiberger wrote: > With effort

Re: [R] List of multidimensional arrays

2012-10-25 Thread Richard M. Heiberger
t; for the first array (that has length equal to 135) of the first comparison > leaving the rest 10 comparisons "NULL". > > On Wed, Oct 24, 2012 at 5:17 PM, Richard M. Heiberger wrote: > >> I am looking at your pdf file. >> >> it doesn't match your description. &g

Re: [R] List of multidimensional arrays

2012-10-24 Thread Richard M. Heiberger
I am looking at your pdf file. it doesn't match your description. There are no missing values in the vectors x, y, t. Each vector has length 55 which is not a multiple of 4, so we don't know where the 2x2 matrices come from. The code doesn't run. There are are too many "}". PDF files are format

Re: [R] Post Hoc tests for ANOVA

2012-10-19 Thread Richard M. Heiberger
Please look at the ?mmc example for two-way ANOVA in library(HH). If you don't already have HH you can get it with install.packages("HH") library(HH) ?mmc mmc uses the glht function in the multcomp package for its calculations and then draws the MMC graph. Rich On 10/19/12, Amartya wrote: > Hi

Re: [R] Windows 7 R (32/64bit) running under cygwin: package not found

2012-10-16 Thread Richard M. Heiberger
I would guess that you installed rgenoud as user, not as administrator. That would put the file inside c:/Users/YourName/AppData/Local/VirtualStore/Program Files/R instead of where you think it is. I can imagine that could easily cause confusion. Rich On Tue, Oct 16, 2012 at 1:14 PM, Aldi Kraja

Re: [R] barplot with some 0 frequencies

2012-10-04 Thread Richard M. Heiberger
barchart(-3:3 ~ letters[1:7], origin=0) On Fri, Oct 5, 2012 at 12:05 AM, David Winsemius wrote: > > On Oct 4, 2012, at 4:49 PM, Guillaume2883 wrote: > > > Hi all, > > > > I am back with a new question ! > > I recorded the occurence of 4 differents event on 20 places for a given > time > > period

Re: [R] changing outlier shapes of boxplots using lattice

2012-09-28 Thread Richard M. Heiberger
Elaine, For panel.bwplot you see that the central dot and the outlier dots are controlled by the same pch argument. I initially set the pch="|" to match your first example with the horizontal indicator for the median. I would be inclined to use the default circle for the outliers and therefore a

Re: [R] boxplot of different colors

2012-09-24 Thread Richard M. Heiberger
t; I read the R manual but could not interpret the part. > "pch" means the point type in plot, but here not sure. > > 2. how to write names under each box > In boxplot, "names" can explain each box, > but here "names" does not work. > > 3. how to

Re: [R] boxplot of different colors

2012-09-24 Thread Richard M. Heiberger
## I would do this in lattice using the panel.bwplot.intermediate.hh ## function from the HH package. ## install.packages("HH") ## if necessary library(HH) dataN <- data.frame(GE_distance=rnorm(260), Diet_B=factor(rep(1:13, each=20))) Diet.colors <- c("forestgreen", "darkgreen

Re: [R] If Command in Plot

2012-09-22 Thread Richard M. Heiberger
Think matrix, not scalar. > tmp <- structure(list(x = c(1, 1, 1, 2, 2, 2, 3, 3, 3), y = c(1, 2, + 3, 1, 2, 3, 1, 2, 3), e = c(0, -1, -2, 1, 0, -1, 2, 1, 0)), row.names = c(NA, + -9L), .Names = c("x", "y", "e"), class = "data.frame") > > tmp x y e 1 1 1 0 2 1 2 -1 3 1 3 -2 4 2 1 1 5 2 2 0 6 2

Re: [R] lattice dotplot reorder contiguous levels

2012-09-20 Thread Richard M. Heiberger
Is result3 what you are looking for? test<-structure(list(site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L), .Label = c

Re: [R] Contrasts for 2x4 interaction in mixed effects model

2012-09-07 Thread Richard M. Heiberger
Stephen, You are looking for the nesting of the FirstFactor within the SecondFactor. Here is an example for your two-way design. The model.matrix shows the dummy variables. The last four columns show the two-level comparisons of Fir within each level of Sec Rich tmp <- data.frame(y=rnorm(16),

Re: [R] splitting character vectors into multiple vectors using strsplit

2012-09-07 Thread Richard M. Heiberger
If you know that there are exactly the same number of items in each string, then something simpler can be constructed. > matrix(unlist(splitlist), length(splitlist[[1]]), length(splitlist)) [,1] [,2] [1,] "a1" "a2" [2,] "b1" "b2" > The rows above are what you are looking for. If you intend

Re: [R] Lattice bwplot(): Changing Orientation of Plots in Multipanel Display

2012-09-06 Thread Richard M. Heiberger
The primary recommendation is to use the "y ~ x" formula rather than the "~ y | x" formula. The place to look first is in the help files ?bwplot ?panel.bwplot Here is a example that matches your data structure Rich tmp <- data.frame(y=rnorm(20), x=rep(letters[1:2], each=10)

Re: [R] How to find the non matching vectors among these five, if so how we can find the non matching element of that vectors?

2012-09-06 Thread Richard M. Heiberger
This should get you started. Rich aa <- c(1,2,3) bb <- c(1,2,3,4) cc <- c(1,2,3) dd <- c(1,2,3) ee <- c(1,4,5) outer.all.equal <- function(input.list) { nn <- names(input.list) if (is.null(nn)) stop("input must be a named list.") n <- length(input.list) result <- vector("list", n*n)

Re: [R] boxplot help

2012-08-15 Thread Richard M. Heiberger
Hi, I recommend the use of panel.bwplot.intermediate.hh in the HH package. This is a lattice function. Lattice usually gives you more control than base graphics. I build your example in several steps here. Critical items to notice: You must declare the months to be ordered; by default they are s

Re: [R] Control y axis

2012-07-20 Thread Richard M. Heiberger
it is a typo you sent plot(x, y, type ="o", xlab="Panelist", ylab="T value",lwd=1.5,lty=1) xlim=range(1:14),ylim=range(-8:8), las=1) it should have been plot(x, y, type ="o", xlab="Panelist", ylab="T value",lwd=1.5,lty=1, xlim=range(1:14),ylim=range(-8:8), las=1) On Fri, Jul 20, 2012 at 3:29

Re: [R] Speeding up a loop

2012-07-20 Thread Richard M. Heiberger
whoops, backwards new.x <- x[!remove.set,] On Fri, Jul 20, 2012 at 2:51 PM, Richard M. Heiberger wrote: > This works to multiply the ith row of a by the ith value of b. > It might be what you can use > > a <- matrix(1:30, 6, 5) > b <- 1:6 > > a > a*b > >

Re: [R] Speeding up a loop

2012-07-20 Thread Richard M. Heiberger
This works to multiply the ith row of a by the ith value of b. It might be what you can use a <- matrix(1:30, 6, 5) b <- 1:6 a a*b To simplify your code, I think you can do this---one multiplication xA <- x %*% A Now you can do the tests on xA and not have any matrix multiplications inside t

Re: [R] Variance Inflation factor

2012-07-11 Thread Richard M. Heiberger
Hui Du, There is probably something wrong with either your setup or your choice of CRAN mirror. Both HH and car are present in CRAN for all platforms. ---Your session info just arrived. "R version 2.11.1 (2010-05-31)" is over two years old. The current version is "R version 2.15.1 (2012-06-22)".

Re: [R] -1.1 - 0.1 + 1.2 is NOT null! Why?

2012-07-11 Thread Richard M. Heiberger
This is a fascinating example. It is an accident that it looks like it comes out even. Here are both sets displayed using hex format where we see exactly what bits are used in the internal representation of the numbers. > dphex <- function(x) {sprintf("%+.13a", x)} > ones <- c(-1.1, +

Re: [R] -1.1 - 0.1 + 1.2 is NOT null! Why?

2012-07-10 Thread Richard M. Heiberger
This is the behavior of the floating point number representation. Decimal fractions do not come out even in binary notation. Please see FAQ 7.31 On Tue, Jul 10, 2012 at 4:17 PM, ollestrat wrote: > Hello, > > I fear its a stupid question,..but here it is: > > If I do this simple calculation with

Re: [R] Difference between two-way ANOVA and (two-way) ANCOVA

2012-07-04 Thread Richard M. Heiberger
The usual terminology uses the number of "ways" to mean the number of factors (categorical or classification variables, with more than one degree of freedom per factor). The term covariate is used for continuous variables, with exactly one df. On Wed, Jul 4, 2012 at 9:20 AM, syrvn wrote: > Hi! >

Re: [R] array complexity for the MH test

2012-06-25 Thread Richard M. Heiberger
I will try again. 1. If you have 5 groups, and split each in half, then you have 10 groups. If MH is applicable to 5 groups, then it should be applicable to the 10 groups as long as they are disjoint groups. 2. I don't think MH applies to your example because the groups do not have similar behavi

Re: [R] Going "backwards" through plot panels

2012-06-20 Thread Richard M. Heiberger
?par read about mfg which allows you to index into the arrangement set by mfrow and mfcol Rich On Wed, Jun 20, 2012 at 5:27 PM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > R-helpers, > > I'm looking to set up multi-screen plots with layout() or > par(mfrow/mfcol = ) but I'm not su

Re: [R] array complexity for the MH test

2012-06-20 Thread Richard M. Heiberger
You have a very nice graph of a dose-response function here. library(vcd) library(RColorBrewer) Pen <- array(c(0, 0, 6, 5, 3, 0, 3, 6, 6, 2, 0, 4, 5, 6, 1, 0, 2, 5, 0, 0), dim = c(2, 2, 5), dimnames = list( Delay = c("None", "1.5h"),

Re: [R] How do I obtain the current active path of a function that's being called?

2012-06-05 Thread Richard M. Heiberger
I think your best option is to invest time in learning how to build an R package, and then package each project. Conflicting names are not a problem when you have them inside package namespaces. See the extensions document in R in the R distribution R-2.15.0/doc/manual/R-exts.html One way to han

Re: [R] How to create a floating bar plot

2012-05-31 Thread Richard M. Heiberger
Please look at the likert function in the HH package. ?likert has many examples. Here is the code for your query ## install.packages("HH") ## if necessary library(HH) twobar <- data.frame(neg=c(8,0,9,2), pos=c(12,9,0,4)) likert(twobar) Rich On Thu, May 31, 2012 at 9:30 AM, Sarah Goslee wrote: >

Re: [R] use xyplot to plot mean and CI by groups

2012-05-29 Thread Richard M. Heiberger
I am showing two alternatives, both from the HH package. install.packages("HH") The first one does essentially what you request, smithdata <- src[c("x", "trt")] smithdata$timefactor <- factor(src$time) position(smithdata$timefactor) <- as.numeric(levels(smithdata$timefactor)) position(smithdata$t

Re: [R] problem with Rcmdr

2012-05-29 Thread Richard M. Heiberger
Please See John Fox's notes http://socserv.socsci.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html and perhaps other parts of his website. On Tue, May 29, 2012 at 10:06 AM, mabel alsina harris wrote: > > Hi!! > My question is related to Rcmdr. I have Mac OS and I use R since more or > less 1

Re: [R] need help in logistic regression

2012-05-28 Thread Richard M. Heiberger
Look at ?predict.glm mydata.glm <- glm(formula = Death ~ Temperature, family = binomial(link = "logit"), data = mydata) and see that predict(mydata.glm, type="response") gives the predictions on the probability scale. On Mon, May 28, 2012 at 10:16 AM, eddie smith wrote: > Hello everyone, > > I

Re: [R] Problem with strptime

2012-05-27 Thread Richard M. Heiberger
Some of your dates are displayed BST and some GMT. High probablilty your dates span the break between summer time and regular time when certain hours do not exist. (in the US we go from 0200 directly to 0301 in the spring when we move from standard time to daylight time). 0230 would therefore be

Re: [R] barplot problem

2012-05-27 Thread Richard M. Heiberger
I would use barchart in lattice. To get control of spacing you need to use the panel.barchart with the xyplot function. I show two options below. The first labels the distance scale with the default values seq(0,300,50), The second labels the bars with their distance value. tmp <- data.frame(y

Re: [R] Graph to visualize paired t test

2012-05-22 Thread Richard M. Heiberger
tmp <- data.frame(A=sample(20,10), B=sample(20, 10)) with(tmp, t.test(A, B)) matplot(t(tmp), type="b") This does what you asked for. I don't understand the legend on your plot. For future queries, PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

Re: [R] getting a Likert plot from a data frame

2012-05-22 Thread Richard M. Heiberger
out-of-phase problem Update to HH_2.3-15 that was published on CRAN yesterday. In HH_2.2-23 you needed to use a slightly longer name plot.likert() instead of likert() On Tue, May 22, 2012 at 9:44 AM, Liviu Andronic wrote: > Dear Richard > > > On Tue, May 22, 2012 at 3:20 P

Re: [R] getting a Likert plot from a data frame

2012-05-22 Thread Richard M. Heiberger
Gavin, thank you for using likert() There are several problems in the use of a data.frame. 1. df is a bad name to use because df is the name of a base function (that isn't an error, it is bad style). 2. the as.character() made the line you sent not work. 3. you indeed have the variable cat as a f

Re: [R] include a dataset in my package

2012-05-21 Thread Richard M. Heiberger
you do have a dataset x. it is probably inside the test.rda file. start a fresh R session and library(yourPackage) then ls() data(test) ls() ## you will probably have now have x. Should you need to use load, then use load("/full/path/to/test.rda") ## in quotes ls() The idiom for saving a data

Re: [R] registry vulnerabilities in R

2012-05-09 Thread Richard M. Heiberger
One more item. Have you given a copy of the document R: Regulatory Compliance and Validation Issues A Guidance Document for the Use of R in Regulated Clinical Trial Environments http://www.r-project.org/doc/R-FDA.pdf to your security office? It addresses overlapping, not identical, security

Re: [R] registry vulnerabilities in R

2012-05-09 Thread Richard M. Heiberger
I spoke to someone in the military who did some investigation. This is his response >> 1. I'm sorry that I don't have anything good to report. The military is >> cautious with it's networks and I'm no longer able to use R at work. I >> don't know anything about this registry issue but the show s

Re: [R] c() in Mac does not work

2012-05-05 Thread Richard M. Heiberger
almost certainly you restored an old workspace with a conflicting definition of the c function. type c to confirm, also type conflicts(detail=TRUE) The repair is to remove the conflicting definition rm(c) The long term solution is to adopt the recommended practice of not saving your worksp

Re: [R] ANOVA problem

2012-05-04 Thread Richard M. Heiberger
The following constructs the data.frame that I think the original poster asked for. I don't understand the graph, so I didn't attempt it. I agree with Bert that this might not make sense. Specifically, the distinction between AB01 and AB02 is not modeled, and that is probably the critical factor.

Re: [R] bwplot: using a numeric variable to position boxplots

2012-05-03 Thread Richard M. Heiberger
Michael, I normally do this with the panel.bwplot.intermediate.hh in the HH package. This function works by plotting each box with its own call to the underlying panel.bwplot function. This example from ?HH::position uses the "positioned" class to determine where to place the box. > library(HH)

Re: [R] repeat matrix rows as a whole

2012-04-25 Thread Richard M. Heiberger
> a <- matrix(1:8, 2, 4, byrow=TRUE) > a [,1] [,2] [,3] [,4] [1,]1234 [2,]5678 > a[c(1,2,1,2),] [,1] [,2] [,3] [,4] [1,]1234 [2,]5678 [3,]1234 [4,]5678 > On Wed, Apr 25, 2012 at 8:32 PM, Rebec

Re: [R] need advice on using excel to check data for import into R

2012-04-22 Thread Richard M. Heiberger
This looks like a perfect case for an RExcel solution. RExcel is an addin that allows you, among other things, to place an arbitrary R function inside the Excel automatic recalculation mode. For details see rcom.univie.ac.at There are many references item listed on the wiki page in the left panel.

Re: [R] using "factor" to eliminate unused levels without dropping other variables

2012-04-21 Thread Richard M. Heiberger
replace the line data.subset2 <- factor(data.subset1$Sample) with data.subset1$Sample <- factor(data.subset1$Sample) I assume your intention is to change the levels of the Sample variable in the data.subset1 data.frame. On Sat, Apr 21, 2012 at 3:54 PM, Melissa Rosenkranz < melissarosenkr...@g

Re: [R] how to plot separate lm ablines on the same xyplot by group

2012-04-18 Thread Richard M. Heiberger
please look at the ancova function in the HH package. On Wed, Apr 18, 2012 at 3:34 PM, Louis Plough wrote: > Hi, > I am trying to use xyplot to plot the relationship between size and day > (y~x) by a food factor that has two levels, low and high. I have 3 reps per > factor/day. I want the plot

Re: [R] introducing R to high school students

2012-04-17 Thread Richard M. Heiberger
Christopher, I suggest that you look at R through Excel. This is a Springer book that Erich Neuwirth and I wrote. It is designed as a computational supplement to any introductory Statistics book. It uses Erich's RExcel to give either menu access to R from Excel (using Rcmdr embedded into the Ex

Re: [R] selective labels display on histogram

2012-04-12 Thread Richard M. Heiberger
Is this what you mean? x <- rnorm(12) histogram(x) histogram(x, scales=list(x=list(at=c(-1, 1), labels=c("minus one", "one" On Thu, Apr 12, 2012 at 9:28 AM, carol white wrote: > Hello, > Is it possible to selectively display labels on a histogram? > > Thanks > > Carol > >[[alterna

Re: [R] pyramid.plot in plotrix, axis labelling

2012-04-12 Thread Richard M. Heiberger
Gavin, Thank you for this example. I would use the as.pyramidLikert function in the HH package. The resulting plot is a standard lattice plot, so any fine tuning uses that standard lattice features. Rich > ## install.packages("HH") ## if necessary > library(HH) > mydata <- cbind(mpop,fpop)[10

Re: [R] How do Sweave users collaborate with Word users?

2012-04-09 Thread Richard M. Heiberger
You might want to consider SWord, which provides similar facilities for the Word and R user. Word-oriented co-authors can modify the Word part of the document without impacting the R part of the document. SWord is by Thomas Baier tho...@statconn.com, author of the statconnDCOM interface that is u

Re: [R] Fisher's LSD multiple comparisons in a two-way ANOVA

2012-04-06 Thread Richard M. Heiberger
ylim=c(50,600)) }) On Fri, Apr 6, 2012 at 5:01 AM, Jinsong Zhao wrote: > On 2012-04-05 10:49, Richard M. Heiberger wrote: > >> Here is your example. The table you displayed in gigawiz ignored the >> two-way factor structure >> and interpreted the da

Re: [R] A kind of set operation in R

2012-04-05 Thread Richard M. Heiberger
At least two ways > (!is.na(match(X, Y))) [1] FALSE TRUE TRUE FALSE TRUE TRUE > X %in% Y [1] FALSE TRUE TRUE FALSE TRUE TRUE > On Thu, Apr 5, 2012 at 3:32 PM, Julio Sergio wrote: > I have an ordered "set" of numbers, represented by a vector, say > > > X <- c(10:13, 17,18) > > X > [1]

Re: [R] Fisher's LSD multiple comparisons in a two-way ANOVA

2012-04-04 Thread Richard M. Heiberger
Here is your example. The table you displayed in gigawiz ignored the two-way factor structure and interpreted the data as a single factor with 6 levels. I created the interaction of a and b to get that behavior. ## your example, with data stored in a data.frame tmp <- data.frame(x=c(76, 84, 78,

Re: [R] avoiding for loops

2012-03-25 Thread Richard M. Heiberger
> df1 <- data.frame(group=c("red", "red", "red", "blue", "blue", "blue"), id=c("A", "B", "C", "D", "E", "F")) df1 <- data.frame(group=c("red", "red", "red", "blue", "blue", + "blue"), id=c("A", "B", "C", "D", "E", "F")) > df1 group id 1 red A 2 red B 3 red C 4 blue D 5 blue E 6 blue

Re: [R] How to draw table in Latex without using xtable?

2012-03-23 Thread Richard M. Heiberger
You can use xtable() or latex() and then edit the columns names in the generated .tex file. That is a much better plan than reinventing either of those functions. On Thu, Mar 22, 2012 at 3:46 AM, Manish Gupta wrote: > Hi, > > I am working on table suing R and Latex. I am writing .Rnw file first

Re: [R] Create weird type of sequences

2012-03-22 Thread Richard M. Heiberger
rep(1:4, c(1,2,4,8)) rep has additional arguments that might be helpful to you. ?rep On Thu, Mar 22, 2012 at 1:03 PM, Alaios wrote: > Dear all, > I would like to create the following sequence of numbers > 1 2 2 3 3 3 3 4 4 4 4 4 4 4 4 and so on (actually I double the number of > same elements

Re: [R] Y-axis label on the right hand side in lattice?

2012-03-16 Thread Richard M. Heiberger
yes, xyplot(y ~ x, par.settings=list(layout.widths=list(ylab.right=5, right.padding=0))) See trellis.par.get("layout.widths") for the full set of names and default values On Fri, Mar 16, 2012 at 6:01 PM, Saptarshi wrote: > ylab.right is perfect. However, I am drawing scales on the right axis

Re: [R] Y-axis label on the right hand side in lattice?

2012-03-16 Thread Richard M. Heiberger
from ?xyplot use the ylab.right argument On Fri, Mar 16, 2012 at 2:11 PM, Saptarshi Guha wrote: > Hello, > > Is there a way to add ylab on the right hand side also (in lattice)? > Different from the left hand side? > > Cheers > Saptarshi > >[[alternative HTML version deleted]] > > _

[R] variable values in plotmath expressions

2012-03-15 Thread Richard M. Heiberger
## I would like help in using variable values in plotmath expressions ## in lattice x <- 1:10 y <- 1:10 pval <- .95 plot(y ~ x, ## works as I want in base graphics main=substitute(list(alpha * " = " * group("",list(p),"")), list(p=pval))) plot(y ~ x, ## doesn't work as intended: "pval" is d

Re: [R] Real-Time data transfer from Excel to R

2012-03-14 Thread Richard M. Heiberger
Yes. please look at RExcel. You can download it from rcom.univie.ac.at The wiki page there has many papers discussing similar projects (follow the Literature link in the left column). Followup should be on the rcom mailing list. Rich On Wed, Mar 14, 2012 at 7:12 AM, burcy wrote: > Hi All >

Re: [R] Why predicted values are fewer that the real?

2012-03-02 Thread Richard M. Heiberger
try using glm(...,na.action=na.exclude) See ?na.exclude for the explanation On Fri, Mar 2, 2012 at 11:19 AM, labbig wrote: > Hi > > i am running a glm model family Gamma(link=log) trying to predict a vector > of 1554 (real) values > > Using predict() i got a vector of 950 predicted values inst

Re: [R] Computing line= for mtext

2012-03-01 Thread Richard M. Heiberger
olution for base graphics? > Thanks > Frank > > Richard M. Heiberger wrote > > > > Frank, > > > > This can be done directly with a variant of the panel.axis function. > > See function panel.axis.right in the HH package. This was provided for > me > >

Re: [R] TM reader with text

2012-02-29 Thread Richard M. Heiberger
Most, maybe all, of the example words you posted include ligatures, With "financier" for example, the leading "fi" is rendered in PDF and in most typesetting situations as a ligature with the a single complex character representing the "fi' combination. fi fl I pasted the "fi" and "fl" ligature

Re: [R] Cannot use negative argument in function

2012-02-29 Thread Richard M. Heiberger
This line TT <- *Temp*+273.15 makes it unexecutable. that is not the error you mentioned. should that be TT <- "Temp"+273.15 or TT <- Temp+273.15 or something else? On Wed, Feb 29, 2012 at 2:14 PM, lidaky wrote: > here is the code: > > index.refraction <- function(Temp,Press, RH, CO2) > {

Re: [R] Computing line= for mtext

2012-02-29 Thread Richard M. Heiberger
Frank, This can be done directly with a variant of the panel.axis function. See function panel.axis.right in the HH package. This was provided for me by David Winsemius in response to my query on this list in October 2011 https://stat.ethz.ch/pipermail/r-help/2011-October/292806.html The email t

Re: [R] equivalent from gladder and ladder from stata

2012-02-29 Thread Richard M. Heiberger
>From your description, I believe the ladder function in the HH package is what you are looking for. ## install.packages("HH") ## if necessary library(HH) data(tv) ladder(life.exp ~ ppl.per.phys, data=tv, scales=list(relation="free")) Rich On Wed, Feb 29, 2012 at 6:21 AM, agent dunham wrote:

Re: [R] How would you program an Adverse Events statistical table using R code?

2012-02-25 Thread Richard M. Heiberger
Robert, Plase look at the ae.dotplot function in the HH package. AE (Adverse Events) dotplot of incidence and relative risk ## install.packages("HH") ## if necessary library(HH) ?ae.dotplot In addition to command line access to the function, we have direct access using RExcel from an Excel work

Re: [R] In R 2.14.1, what does wrong sign in 'by' argument mean?

2012-02-21 Thread Richard M. Heiberger
> seq(1,4,1) [1] 1 2 3 4 > seq(1,4,-1) Error in seq.default(1, 4, -1) : wrong sign in 'by' argument > On Tue, Feb 21, 2012 at 1:53 PM, bioinformatics wrote: > Here is my code > > >slidingwindowplotATGC = function(windowsize, inputseq) >{ > >starts = seq(1, length(inputseq)-windowsize

Re: [R] Help on lattice barchart ploting

2012-02-20 Thread Richard M. Heiberger
I do not see the restricted range that you report. There is probably some masking as David pointed out. Try again in a fresh R session with --vanilla. You probably want three additional arguments. update(.Last.value, xlim=c(0, 100), between=list(x=1, y=1), origin = 0) to the barchart function call

Re: [R] ANCOVA post-hoc test

2012-02-12 Thread Richard M. Heiberger
I am at my machine now. The subset of the data you sent has only two groups and doesn't have a significant interaction. Therefore I can't talk about specifics for your example. The glht test you did compared the means of the sampling factor ignoring the dist covariate. Your description said you

Re: [R] the value of the last expression

2012-02-09 Thread Richard M. Heiberger
.Last.value On Thu, Feb 9, 2012 at 9:44 PM, Sam Steingold wrote: > Is there an analogue of common lisp "*" variable which contains the > value of the last expression? > E.g., in lisp: > > (+ 1 2) > 3 > > * > 3 > > I wish I could recover the value of the last expression without > re-evaluating it

Re: [R] Getting codebook data into R

2012-02-09 Thread Richard M. Heiberger
?read.fwf Read Fixed Width Format Files Please, one copy of your request to the list is sufficient. Rich On Thu, Feb 9, 2012 at 3:51 PM, barny wrote: > I've been trying to get some data from the National Survey for Family > Growth > into R - however, the data is in a .dat file and the data

Re: [R] an unusual use for R

2012-02-06 Thread Richard M. Heiberger
I love it. I hope you are planning a talk at the UseR!2012 in Nashville. Do remember the history that one of the origins of punchcards is the Jaquard loom. Rich On Thu, Feb 2, 2012 at 5:54 PM, Sarah Goslee wrote: > I thought some of you might be amused by this. > > In my non-work time, I'm an

Re: [R] Post hoc test for lm() or glm() ?

2012-02-02 Thread Richard M. Heiberger
The glht function in the multcomp package is what you are looking for. There are additional examples in the ?MMC help file in the HH package. Rich On Thu, Feb 2, 2012 at 3:42 PM, Mark Na wrote: > Hi R-helpers, > > TukeyHSD() works for models fitted with aov(), but could anyone point > me to a f

Re: [R] DSC 2003 on www.ci.tuwien.ac.at

2012-01-31 Thread Richard M. Heiberger
4:25 PM, Roy Mendelssohn wrote: > GIYF - http://www.r-project.org/conferences/DSC-2003/Proceedings/ > > -Roy > > On Jan 31, 2012, at 1:18 PM, Richard M. Heiberger wrote: > > > I am trying to get the DSC proceedings from 2003. > > The computer is not responding

[R] DSC 2003 on www.ci.tuwien.ac.at

2012-01-31 Thread Richard M. Heiberger
I am trying to get the DSC proceedings from 2003. The computer is not responding since last night (18 hours ago). Is this transient? Have the DSC files been placed elsewhere? Rich http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Proceedings [[alternative HTML version deleted]] _

Re: [R] dimensions dropped on assignment

2012-01-31 Thread Richard M. Heiberger
> tmp <- matrix(1:12, 3, 4, dimnames=list(letters[1:3], LETTERS[1:4])) > tmp A B C D a 1 4 7 10 b 2 5 8 11 c 3 6 9 12 > tmp["a",, drop=FALSE] A B C D a 1 4 7 10 > tmp[,"A",drop=FALSE] A a 1 b 2 c 3 > you need the correct number of commas. For your example > dim(out[1, drop=FALSE]) [1] 1

Re: [R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Richard M. Heiberger
Are you sure this isn't a dataframe? Some minor rethinking of the structure might get it there. Rich On Mon, Jan 30, 2012 at 1:26 PM, Paul Johnson wrote: > A user question today has me stumped. Can you advise me, please? > > User wants a matrix that has some numbers, some variables, possibly

Re: [R] Is there a R command for testing the difference of two liear regressions?

2012-01-27 Thread Richard M. Heiberger
It looks like you might be asking for the anova() on two models. M1 <- lm(y ~ x1 + x2 + x3, data=something) M2 <- lm(y ~ x2 + x3, data=something) anova(M1, M2) Please send a reproducible example to the list if more detail is needed. Rich On Thu, Jan 26, 2012 at 11:59 PM, Michael wrote:

Re: [R] How to write the entire session to file?

2012-01-27 Thread Richard M. Heiberger
If you save the session into a file with the extension R.out, and then open it in ESS in emacs, you will get the syntax highlighting. On Fri, Jan 27, 2012 at 2:03 PM, Ajay Askoolum wrote: > savehistory writes all the executed lines from the session. > > How can I write everything (executed lines

Re: [R] Interactive map graphics.

2012-01-24 Thread Richard M. Heiberger
On Tue, Jan 24, 2012 at 5:10 PM, Kevin Burton wrote: > I am stuck with R 2.14.0 for now because the COM interface that I am using > (RandFriends) is still on 2.14.0. When I try to install this package (via > the script) I get: RAndFriends had 2.14.1 available several weeks ago. It is there as R

Re: [R] abline by groups

2012-01-20 Thread Richard M. Heiberger
I believe you are looking for analysis of covariance. I recommend the ancova function in the HH package. ## install.packages("HH") ## if needed library(HH) tmp <- ancova(y ~ x + group, data=mydata) tmp ## You suggested that you want the superpose panel. You can get ## that on a single page with

Re: [R] Executable Expressions II

2012-01-18 Thread Richard M. Heiberger
If you are using rcom from Excel, then you would send R the vector of numbers containing the values you were interested in and you would get the mean back. I suggest you look at the RExcel implementation and duplicate its capabilities. The rcom documentation includes examples in other languages t

Re: [R] ggplot2 stacked bar - sum of values rather than count

2012-01-15 Thread Richard M. Heiberger
This is based on lattice, not ggplot, and I hope I understand what you are trying to do. require(lattice) x <- read.table(text=" Value Bar Segment 1.10020075 1 1 -1.37734577 2 1 2.50702876 3 1 0.58737028 3 2 0.21106851 3 3 -2.50119261 4

Re: [R] stacked barplot colour coding

2012-01-11 Thread Richard M. Heiberger
This graph would be easier under lattice graphics. biomass <- data.frame(bg=c(0.41, 0.37, 0.31, 0.32), ag=c(2.81, 2.91, 2.06, 2.39)) b2 <- stack(biomass) names(b2) <- c("mass", "type") b2$type <- factor(b2$type, levels=c("bg","ag")) b2$AB <- rep(c("A","A","B","B"), 2) b2$loca

Re: [R] choosing items from array: very stupid and simple question

2012-01-08 Thread Richard M. Heiberger
This does literally what you asked for > x[x %in% y] [1] 2 3 This is more likely what you want > which(x %in% y) [1] 2 3 > It is an artifact of this example that the two results look the same. Here is a different example that distinguishes them, and in this example, %in% is probably not right ei

Re: [R] Is using glht with "Tukey" for lme post-hoc comparisons an appropriate substitute to TukeyHSD?

2012-01-04 Thread Richard M. Heiberger
- default contrast might be inappropriate > > > TukeyHSD(model3) > > Tukey multiple comparisons of means >95% family-wise confidence level > > Fit: aov(formula = logitAct ~ Treatment * Habitat, data = Active) > > $Treatment > difflwr up

Re: [R] Is using glht with "Tukey" for lme post-hoc comparisons an appropriate substitute to TukeyHSD?

2012-01-02 Thread Richard M. Heiberger
glht is probably what you should be using. Both TukeyHSD and glht give essesntially identical confidence intervals for the example in ?glht. What aren't you satisfied with? amod <- aov(breaks ~ tension, data = warpbreaks) confint(glht(amod, linfct = mcp(tension = "Tukey"))) TukeyHSD(amod) On Mon

Re: [R] Base function for flipping matrices

2012-01-02 Thread Richard M. Heiberger
Hadley, Your request is reminding me of the analysis of aray functions in Philip S Abrams dissertation http://www.slac.stanford.edu/cgi-wrap/getdoc/slac-r-114.pdf AN APL MACHINE The section that starts on page 17 with this paragraph is the one that immediately applies C. The Standard Form for Se

Re: [R] R report generator (for Word)?

2012-01-01 Thread Richard M. Heiberger
Look at the SWord package. It is available from rcom.univie.ac.at. It is the integration of R and Word similar to RExcel at the same site. Rich On Sun, Jan 1, 2012 at 3:31 PM, Joshua Wiley wrote: > Hi Michael, > > I like Sweave and LaTeX, but I can appreciate the difficulty using it > with col

Re: [R] Is it possible to "right align" text in R graphics?

2012-01-01 Thread Richard M. Heiberger
Tal, Plese look at this thread https://stat.ethz.ch/pipermail/r-help/2011-October/292786.html right justify right-axis tick values in lattice and see if the function provided by David Winsemius will work for you. I included it in the HH package as HH:::panel.axis.right Rich On Sun, Jan 1, 2012

Re: [R] vertically stacked area plot?

2011-12-30 Thread Richard M. Heiberger
Ellen, Is this what you are looking for? library(HH) sed <- read.table(textConnection(" sed_depth FT value 0-1 1A 35.16591742 1-2 1A 36.21447839 2-3 1A 19.09701388 3-4 1A 35.86953345 4-10 1A 30.04823571 0-1 1B 15.02829003 1-2 1B 19.15637318 2-3 1B 12.45405429 3-4 1B 25.23130364 4-10 1B 22.94187

Re: [R] R Commander options

2011-12-27 Thread Richard M. Heiberger
It is very easy. Here is my Projector() function from library(RcmdrPlugin.HH) Projector <- function() { Rcmdr <- options()$Rcmdr Projector.options <- list(log.font.size = 15, log.width = 54, log.height = 6, output.height = 18, scale.factor = 1.4) Rcmd

Re: [R] How to create a matrix with 3 dimensions from several 2 dimensional matrice?

2011-12-27 Thread Richard M. Heiberger
Yes, use abind. library(abind) ?abind On Tue, Dec 27, 2011 at 10:34 AM, ali_protocol < mohammadianalimohammad...@gmail.com> wrote: > Hi every one, > > How is it possible to create a matrix with 3 dimensions from several 2 > dimensional matrice? > Is it possible that each of "elementary/buildin

Re: [R] nice report generator?

2011-12-14 Thread Richard M. Heiberger
. > > Statistical Data Center > > Intermountain Healthcare > > greg.s...@imail.org > > 801.408.8111 > > ** ** > > *From:* Richard M. Heiberger [mailto:r...@temple.edu] > *Sent:* Wednesday, December 14, 2011 11:20 AM > *To:* Greg Snow &g

Re: [R] nice report generator?

2011-12-14 Thread Richard M. Heiberger
Greg, Please look at the SWord package. This package integrates MS Word with R in a manner similar to the SWeave integration of LaTeX with R. Download SWord from rcom.univie.ac.at If you have a recent download of RExcel from the RAndFriends installer, then you will already have SWord on your mach

Re: [R] multiple comparison of interaction of ANCOVA

2011-12-12 Thread Richard M. Heiberger
... On Mon, Dec 12, 2011 at 7:00 AM, Jinsong Zhao wrote: > Apart from the data set here, is there a way to do multiple comparison on > the interaction of one way analysis of covariance? > Interaction in ancova usually means the slopes are different. ... BTW, when loading HH package, the TukeyH

Re: [R] multiple comparison of interaction of ANCOVA

2011-12-11 Thread Richard M. Heiberger
Thank you for you use of HH. I think the right graph for this data is the much simpler ancova function library(HH) ancova(y ~ year * Trt, data=mydata) where we see that the three treatments have totally different slopes. The WoodEnergy example doesn't apply here. The WoodEnergy example illus

<    1   2   3   4   5   6   7   8   9   >