Re: [R] lme4 error after Matrix update

2008-12-18 Thread ONKELINX, Thierry
Dear RĂ¼diger, Try to uninstall AND fysically remove (delete) lme4 and Matrix from the harddisk. Then installing them again should do this trick. At least it did on my laptop. HTH, Thierry ir. Thierry Onkelinx Institu

Re: [R] Reading file from remote location or network drive.

2009-01-02 Thread ONKELINX, Thierry
Dear Harsh, You have to replace each "\" with "\\" or try to use "/" instead. HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, method

Re: [R] ggplot: adding layer using different data, groups and also controlling appearance

2009-01-02 Thread ONKELINX, Thierry
Dear Juliet, I think you want this dataset <- rbind(foo, bar) ggplot(dataset, aes(x = x, y = y, colour = membership)) + geom_point() + scale_colour_manual(values = c("green", "red", "black")) HTH, Thierry ir. Thier

Re: [R] how specify lme() with multiple within-subject factors?

2009-01-04 Thread ONKELINX, Thierry
Dear Ben, I'm cc'ing R-sig-mixed-models because that's a more appropriate list for questions on lme(). Lme() is only able to work with nested random effects, not with crossed random effects. Therefore you would need lmer() from the lme4 package. But I don't think you need crossed random effects.

Re: [R] Sweave data-figure coupling

2009-01-06 Thread ONKELINX, Thierry
Another options is to write a custom function that saves the plot to a file and generates the required latex code. Here is a rather simple function that creates jpeg files with the ggplot2-package. But you could easily modify it to work with other devices or other packages. exportJpeg <- fu

Re: [R] R Stacked Histogram

2009-01-06 Thread ONKELINX, Thierry
Dear Jason, Have a look at scale_y_continuous() and scale_fill_discrete(). This might work (untested as your example is not reproducible with a (dummy) dataset). qplot(Age, data = recerts_combined_values, binwidth = 5, fill = combined_values$Test.Type, main="Combined Age Histogram") + scale_x_

Re: [R] Faster Printing Alternatives to 'cat'

2009-01-08 Thread ONKELINX, Thierry
Yoo should have a look at ?write.table dataset <- cbind(foo, bar, qux) #write to a file write.table(x = dataset, file = "your_file_name.txt", sep = "\t", row.names = FALSE) #wrfite to the console write.table(x = dataset, file = "", sep = "\t", row.names = FALSE) HTH, Thierry -

Re: [R] recursive relevel

2009-01-09 Thread ONKELINX, Thierry
Dear Baptiste, You can avoid the recursive stuff. And it will run about twice as fast. > order.factor <- function (x, ref) + { + last.index <- length(ref) # convenience for matlab's end keyword + if(last.index == 1) return(relevel(x, ref)) # end case, normal case + my.new.list <- list(x=re

Re: [R] indexing question

2009-01-13 Thread ONKELINX, Thierry
Dear Bunny, You need to add a comma: data[data$particularcol ==1, ] data[put here the conditions for rows, put here conditions for columns]. HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek

Re: [R] Tables for journal/conference publications from within R

2009-01-13 Thread ONKELINX, Thierry
Dear Jason, I would suggest xtable (from the xtable package) and LaTeX / Sweave. HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, met

Re: [R] Logical function to turn missing values to 0's

2009-01-15 Thread ONKELINX, Thierry
Use the is.na function to test for NA values. And do read about vectorizing your code. You don't need loops for this problem. Without loops your code will run more than 400 times faster! > n <- 1000 > x <- matrix(data=rep(c(1,2,3,NA), n), ncol=n, nrow=n) > > system.time({ + y <- matrix(data=0

Re: [R] reference category for factor in regression

2009-01-19 Thread ONKELINX, Thierry
Dear Jos, In R you don't need to create you own dummy variables. Just create a factor variable LABOUR (with two levels) and rerun your model. Then you should be able to calculate all coefficients. HTH, Thierry ir. Thi

Re: [R] Sweave: conflict between setwd and \SweaveOpts{prefix.string=}

2009-01-20 Thread ONKELINX, Thierry
Have you tried specifying an absolute path in prefix.string instead of a relative one? HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie

Re: [R] reshape() problems

2009-01-22 Thread ONKELINX, Thierry
Dear Robin, It is rather easy if you combine melt() and cast() from the reshape package. dataset <- expand.grid(year = 1940:1942, cell = 1:2) dataset$Q1 <- rnorm(nrow(dataset)) dataset$Q2 <- rnorm(nrow(dataset)) dataset$Q3 <- rnorm(nrow(dataset)) dataset$Q4 <- rnorm(nrow(dataset)) library(reshape

Re: [R] ggplot2 example

2009-01-23 Thread ONKELINX, Thierry
Hi Felipe, As I recall that is a known bug in the current version of ggplot2. Cheers, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, met

Re: [R] ggplot seq

2009-01-23 Thread ONKELINX, Thierry
Dear Felipe, Provide a dummy sample if your dataset is big or confidential. The actual values are not that important to figure out what kind of plot you want. How did you code Week? Numeric? Try convert it into a factor with levels = c(27:52, 1:26). And then set the breaks to seq(1, 52, by = 2).

Re: [R] ggplot2

2009-01-23 Thread ONKELINX, Thierry
Dear Vikas, First a few remarks: - as we don't have your dataset, your example is not reproducible. Please do add a (dummy) dataset next time. - adding spaces makes code much more readable. - why do you use scale_colour_gradient2 if you set the midpoint at the lower level? Use scale_colour_gradien

Re: [R] ggplot seq

2009-01-24 Thread ONKELINX, Thierry
yahoo.com] Verzonden: vrijdag 23 januari 2009 18:44 Aan: r-h...@stat.math.ethz.ch; ONKELINX, Thierry Onderwerp: RE: [R] ggplot seq Actually 'levels' works OK by ordering the x axis labels but since I have 52 weeks it gets too crowded. Here's part of my dataset with a reproducible exam

Re: [R] How to collect arrays in an array?

2009-01-30 Thread ONKELINX, Thierry
You'll need the [[ operator. Your.list.name[[3]] gives the third element. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteits

Re: [R] Defining plot colors based on a variable

2009-02-02 Thread ONKELINX, Thierry
Dear Andrew, Have a look at ggplot2 library(ggplot2) ggplot(curr_assoc, aes(x = BP, y = P, colour = FILE)) + geom_point() + scale_y_log10() HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek /

Re: [R] Problems in Recommending R

2009-02-02 Thread ONKELINX, Thierry
Dear Fritz, I'm wondering if the use of plain HTML is a conditio sine qua non. What are the advantages of maintaining the website via SVN? IMO maintaining a website and source code are two separate things. Just my 2 cents. Thierry -

Re: [R] lapply and aggregate function

2009-02-03 Thread ONKELINX, Thierry
Have a look at cast() form the reshape package. library(reshape) set.seed(123) myD <- data.frame( Light = sample(LETTERS[1:2], 10, replace=T), Feed = sample(letters[1:5], 20, replace=T), value=rnorm(20) ) cast(myD, Light ~ ., fun = mean) cast(myD, Feed ~ ., fun = m

Re: [R] Using color and plotting characters in a scatterplot matrix [Newbie Help]

2009-02-04 Thread ONKELINX, Thierry
First make a factor with the levels. jet$Classes <- factor(ifelse(jet$amtemp < 90, "low", ifelse(jet$amtemp < 100, "medium", "high"))) Then make life easier and use ggplot install.packages("ggplot2") library("ggplot2") ggplot(jet, aes(x = amtemp, y = thrust, colour = Classes)) + geom_point() HT

Re: [R] ANOVA in R

2009-02-04 Thread ONKELINX, Thierry
Dear Samor, Note that the R-Sig-mixed-models is more suitable for that kind of questions. You need to add "+", ":" or "*" between the variables in the formula The correlation is lme() is not the same as the correlation in SAS. The correlation in lme() is the correlation among residuals, not am

Re: [R] loading lme4 fails - "function 'cholmod_l_start'not providedbypackage 'Matrix'"

2009-02-04 Thread ONKELINX, Thierry
Megan, Try to uninstall both packages, remove them from the harddrive and then reinstall them. That worked for me when I had a similar problem (lme4 complaining about Matrix). HTH, Thierry ir. Thierry Onkelinx Institu

Re: [R] loading lme4 fails - "function 'cholmod_l_start' notprovided by package 'Matrix'"

2009-02-04 Thread ONKELINX, Thierry
Dear Megan, It looks like you don't have the latest version of the Matrix package. HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, me

Re: [R] A way to "lock down" the order of bars for ggplot "dodged"histogram

2009-02-05 Thread ONKELINX, Thierry
Dear Jason, Convert Person to a factor with the levels in the order that you want. Group_df$Person <- factor(Group_df$Person, levels = c("Them", "You", "Me")) HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur-

Re: [R] A way to "lock down" the order of bars for ggplot "dodged"histogram

2009-02-06 Thread ONKELINX, Thierry
hat a reasonable answer can be extracted from a given body of data. ~ John Tukey Van: Jason Rupert [mailto:jasonkrup...@yahoo.com] Verzonden: donderdag 5 februari 2009 17:44 Aan: R-help@r-project.org; ONKELINX, Thierry CC: ggpl...@googlegroups.com Onderwerp: RE: [R]

Re: [R] Installing package RODBC error - please help

2009-02-09 Thread ONKELINX, Thierry
Try using a mirror instead of cran.r-project.org. HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Se

Re: [R] (no subject)

2009-02-09 Thread ONKELINX, Thierry
Dear Glenn, Are you looking for str()? Try str(bycontract) HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteits

Re: [R] How to comment in R

2009-02-11 Thread ONKELINX, Thierry
Via the menu choose: Format --> Block --> Comment Or use the shortcut key alt+C HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, metho

[R] OPGELET PHISINGRE: How to comment in R

2009-02-11 Thread ONKELINX, Thierry
bericht- Van: mihai.mira...@bafin.de [mailto:mihai.mira...@bafin.de] Verzonden: woensdag 11 februari 2009 11:18 Aan: soren.hojsga...@agrsci.dk; ONKELINX, Thierry; r-help@r-project.org Onderwerp: AW: [R] How to comment in R Well, I don't care so much if it is */ or something else, I just want to find

Re: [R] Label bars in a faceted bar plot in ggplot2

2009-02-11 Thread ONKELINX, Thierry
Dear Harsh, Have a look at geom_text() ggplot(df, aes(x = Models, y = Values)) + geom_bar() + geom_text(aes(y = Values + 1, label = round(Values, 2))) + facet_grid(.~Type) HTH, Thierry ir. Thierry Onkelinx Instituu

Re: [R] trunc/floor a number -- strange bahaviour

2009-02-12 Thread ONKELINX, Thierry
That is not strange behaviour. It's a case of FAQ 7.31: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bo

Re: [R] joining "one-to-many"

2009-02-17 Thread ONKELINX, Thierry
Hi Monica, merge(t1, t2) works on your example. So why don't you use merge? HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodolo

Re: [R] Remove top-K elements in Vector

2009-02-18 Thread ONKELINX, Thierry
Have a look at ?tail tail(x, -3) should do the trick. HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg

Re: [R] Initialize varFunc in R

2009-02-24 Thread ONKELINX, Thierry
Dear Tania, Shouldn't that be varIdent(form = ~species.group) instead of varIdent(form = ~1|species.group)? Notice that this is untested as you did not provide a self-contained example (as de posting guide asked you to do). HTH, Thierry PS Next time try the mixed-models mailing list with quest

Re: [R] (no subject)

2009-02-26 Thread ONKELINX, Thierry
Dear Tanja, R-Sig-Mixed-models is a better list for questions about lme4 and nlme. There you are much more likely to get an answer from the mixed models specialists. First of all I would recommend you to write the random effect as (1|fips) instead of (1|as.factor(diab$fips)). You will run into tr

Re: [R] ggplot2: labels points with different colors or idnumbers

2009-02-26 Thread ONKELINX, Thierry
Dear Tom, I think you better switch to ggplot() instead of qplot(). library(ggplot2) dat <- expand.grid(id = 1:10, time = 1:3, group = 1:3) dat$Freq <- rnorm(nrow(dat), mean = dat$id * dat$time) ggplot(dat, aes(x = factor(time), y = Freq)) + geom_boxplot() + geom_jitter(aes(colour = factor(id)))

Re: [R] Singularity in a regression?

2009-02-26 Thread ONKELINX, Thierry
It looks like your data has not enough information to estimate the parameter for metaCl. Maybe because metaCL is identical to one of the other variables or a constant. HTH, Thierry ir. Thierry Onkelinx Instituut voor

Re: [R] bottom legends in ggplot2 ?

2009-02-27 Thread ONKELINX, Thierry
I would think that the lines below should work but they give an error. Hadley, can you clarify this? Cheers, Thierry > library(ggplot2) > qplot(mpg, wt, data=mtcars, colour=cyl) + opts(legend.position = "bottom") Error in grid.Call.graphics("L_setviewport", pvp, TRUE) : Non-finite location an

Re: [R] gplot problems with faceting

2009-02-27 Thread ONKELINX, Thierry
Dear Pascal, I thik you need to define the facets as facets = ~ Par Instead of facets = Par ~ . The Par ~ . Syntax can be used with facet_grid and not with facet_wrap. HTH, Thierry ir. Thierry Onkeli

Re: [R] Making tapply code more efficient

2009-02-27 Thread ONKELINX, Thierry
Hi Harold, What about this? You one have to make the crosstabulation once. > qq <- data.frame(student = factor(c(1,1,2,2,2)), teacher = factor(c(10,10,20,20,25))) > tab <- table(qq$student, qq$teacher) > data.frame(Student = rownames(tab), Freq = rowSums(tab), tch = rowSums(tab > 0) == 1) Stude

Re: [R] R-code help for filtering with for loop

2009-03-02 Thread ONKELINX, Thierry
Dear John, It looks like you are stuck in both the second and the third circle of the R inferno (http://www.burns-stat.com/pages/Tutor/R_inferno.pdf) You problem is easy to vectorise. #could the number of columns >= 64 in each row NumCols <- rowSums(datax >= 64) #select rows with at least one co

Re: [R] ggplot2: annotated horizontal lines

2009-03-04 Thread ONKELINX, Thierry
Dear Dave, Another option would be to manually create the breaks of your plot. library(ggplot2) myBreaks <- sort(c(pretty(mtcars$mpg), min(mtcars$mpg))) ggplot(aes(x = wt, y = mpg), data = mtcars) + geom_point() + geom_hline(yintercept = min(mtcars$mpg)) + scale_y_continuous(breaks = myBreaks)

Re: [R] is there any option like cex.axis in ggplot2?

2009-03-05 Thread ONKELINX, Thierry
Dear Tom, You can control the size of the axis title in ggplot2. It is described in the ggplot2 book. Have a look at Chapter 8: Polishing your plots for publication. You can find the book on the ggplot2 website. I tend to create my own theme for some specific type of plots. Below you can find

[R] Ggplot2: saving a grid with multiple plots

2009-03-11 Thread ONKELINX, Thierry
Hi all, I have managed to create a figure on the screen with multiple plots in it. Something like the example below. When I save that with ggsave(), only the last plot gets saved (pPath in the example) instead of the entire figure. Any suggestions how I can save this kind of figures automated? Th

Re: [R] Mixed models fixed effects

2009-03-11 Thread ONKELINX, Thierry
Hi Emma, Continuous predictors are no problem at all. You can mix both continuous and categorial predictors if needed. I suppose your response are counts (the number of bats that passes)? In that case a generalised linear mixed model is more appropriate. With the lme4 package you could try somethi

Re: [R] Ggplot2: saving a grid with multiple plots

2009-03-12 Thread ONKELINX, Thierry
-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens Dieter Menne Verzonden: donderdag 12 maart 2009 9:04 Aan: r-h...@stat.math.ethz.ch Onderwerp: Re: [R] Ggplot2: saving a grid with multiple plots ONKELINX, Thierry inbo.be> writes: > I have managed to create a figure on

Re: [R] set size of a plot

2009-03-12 Thread ONKELINX, Thierry
?pdf reads: width, height the width and height of the graphics region in inches. The default values are 7. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel bio

Re: [R] Mixed models fixed effects

2009-03-13 Thread ONKELINX, Thierry
2009 10:50 Aan: ONKELINX, Thierry; Emma Stone; r-help@r-project.org Onderwerp: RE: [R] Mixed models fixed effects Hi Thierry, That's great thanks! I have done as you have said but I keep getting a warning message here is my code: G1Hvol<-glmer(passes~hvolume+style+habitat(1|Site),family =

Re: [R] Mixed models fixed effects

2009-03-13 Thread ONKELINX, Thierry
an be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: Emma Stone [mailto:emma.st...@bristol.ac.uk] Verzonden: vrijdag 13 maart 2009 11:08 Aan: ONKELINX, Thierry; Emma Stone; r-help@r-project.org Onderwerp: RE: [R] Mixed models fixed effects Hi Thierry, Thank

Re: [R] two histograms in the same graph

2008-01-24 Thread ONKELINX, Thierry
That's an easy one with ggplot2. library(ggplot2) dataset <- data.frame(variable = gl(2, 50, labels = c("x", "z")), value = c(runif(50), rnorm(50))) ggplot(data = dataset, aes(x = value, fill = variable)) + geom_histogram(position = "dodge") + scale_fill_manual(values = c("red", "blue"), guide = "

Re: [R] using facet_grid() from ggplot2 with additional text in labels

2008-01-28 Thread ONKELINX, Thierry
Dear Rainer, I think you'll have to recode the labels of the levels to get the output that you want. levels(ssq$gi) <- c("gi = 1", "gi = 2", "gi = 3") HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bos

Re: [R] how do i creat multiple back to back histograms?

2008-01-29 Thread ONKELINX, Thierry
Maybe this is what you'd like. library(ggplot2) freqs <- data.frame(value= c( 0.000,1.204,1.301,1.362,1.447,1.505,1.602,1.653,1.756,1.806,1.903,1.959, 2.053,2.107,2.204,2.258,2.354,2.408,2.505,2.559,2.656,2.709,2.806) , tp1= c( 8,1,0,13,0,6,0,25,0,5,0,15,0,4,0,7,0,0,0,1,0,0,0) ,

Re: [R] Reformatting data into data frame and plotting it in ggplot2

2008-02-01 Thread ONKELINX, Thierry
Tribo, Use data.frame() and rbind() to combine the vectors. x_test1 <- c(1:10) y_test1<-rnorm(10) x_test2 <- c(1:15) y_test2<-rnorm(15) x_test3 <- c(1:20) y_test3<-rnorm(20) dataset <- rbind(data.frame(Test = "Test 1", x = x_test1, y = y_test1), data.frame(Test = "Test 2", x = x_test2, y

Re: [R] Reformatting data into data frame and plotting it in ggplot2

2008-02-01 Thread ONKELINX, Thierry
ics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney -Oorspronkelijk bericht- Van: Tribo Laboy [mailto:[EMAIL PROTECTED] Verzonden: vr

Re: [R] Reformatting data into data frame and plotting it in ggplot2

2008-02-01 Thread ONKELINX, Thierry
2008 15:18 Aan: ONKELINX, Thierry CC: r-help@r-project.org Onderwerp: Re: [R] Reformatting data into data frame and plotting it in ggplot2 For some reason I get the following error: "Error: could not find function "scale_colour_manual" so I couldn't make the plots. Otherwis

Re: [R] Histogram/Bar plot graph

2008-02-06 Thread ONKELINX, Thierry
You'll need to transform your dataset in a long format first. library(ggplot2) n <- 5 MyValues <- data.frame(Gene = factor(LETTERS[seq_len(n)]), ES = rnorm(n), MEF = rnorm(n), Embrio = rnorm(n), EShyp = rnorm(n)) MyValuesMelt <- melt(MyValues, id.var = "Gene") ggplot(MyValuesMelt, aes(x = Gene, y

Re: [R] Multivariate Maximum Likelihood Estimation

2008-02-06 Thread ONKELINX, Thierry
It seems like you didn't look at the examples in the helpfiles. See ?gls and ?corAR1. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en

Re: [R] Bode plots in ggplot2

2008-02-07 Thread ONKELINX, Thierry
Tribo, Suppose you dataset is called bode. Then "melt" it: Melted <- melt(bode, id.var = c("frequency", "system") Then you'll get something like. frequency | system | variabele | value 0 | system 1 | phase | 0 0 | system 1 | gain | 100 then this line below should do the trick (untested) ggplo

Re: [R] R ver 2.0.1 NA in Probability Vector Error Messages

2008-02-09 Thread ONKELINX, Thierry
Gabriella, First of all I would suggest that you upgrade to a recent R version (2.6.2). Without a reprodicible example of your code it is very hard to examine the problem. Use traceback() to identify were the problem occurs in your code. HTH, Thierry --

Re: [R] R is not reading(?) my data properly

2008-02-09 Thread ONKELINX, Thierry
Alexander, Learn to use the data argument. E.g. plot(rgnpc, incmean, data = pol572a1) Model <- lm(incmean ~ rgnpc, data = pol572a1) to get the fitted values: Model$fitted HTH, Thierry PS It seems to me that you might want to read a good introduction into R.

Re: [R] How to run one-way anova R?

2008-02-12 Thread ONKELINX, Thierry
?aov ?anova ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance G

Re: [R] How to make t.test handle "NA" and "essentially constantvalues" ?

2008-02-12 Thread ONKELINX, Thierry
Have a look at ?try try(t.test(x)) HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometri

Re: [R] problems plotting geom_line on ggplot2

2008-02-12 Thread ONKELINX, Thierry
Try this. ggplot(data = DF, aes(x=Hora, y=PAC) + geom_line() HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteit

Re: [R] problems plotting geom_line on ggplot2

2008-02-12 Thread ONKELINX, Thierry
Just to inform the list that the problem is solved: This problem was due to DF$Hora being a factor. Converting it to numeric or time solved the problem. Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzo

Re: [R] storing ggplot objects as components of a vector

2008-02-15 Thread ONKELINX, Thierry
You'll need to store it in a list rather than a vector. library(ggplot2) DF<-data.frame(A=rnorm(12),B=c(1:12),C=rep(c(1:4),each=3)) Q <- list() PAC<-geom_point(mapping=aes(x=A,y=B),data=DF[DF$C==1,]) P<-ggplot()+PAC Q[[length(Q) + 1]] <- P Q[[1]] You could shorten this into library(ggplot2) DF<-

Re: [R] qplot

2008-02-19 Thread ONKELINX, Thierry
Format your dataframe into a long format. Then use a grouping variable to distinguish both lines. library(ggplot2) DF <- data.frame(X = rep(0:20, 2), Y = c(rnorm(21), runif(21)), Z = gl(2, 21)) ggplot(data = DF, aes(x = X, y = Y, colour = Z)) + geom_line() HTH, Thierry PS. I suggest you read th

Re: [R] Getting started help

2008-02-19 Thread ONKELINX, Thierry
If someone told you to learn R, then there must a local R guru in your neighbourhood. Therefore I would suggest that you consult this person first. Reading an introduction into R will help you too (e.g. Peter Dalgaard. Introductory Statistics with R. Springer, 2002. ISBN 0-387-95475-9) HTH, Thie

Re: [R] Simultaneously summarizing many models

2008-02-22 Thread ONKELINX, Thierry
Store the models into a list and the use an apply-function. x=1:10 #this creates some example data y=rnorm(10) m1=lm(x~y) m2=lm(x~1) Models <- list(m1, m2) lapply(Models, summary) HTH, Thierry ir. Thierry Onkelinx I

Re: [R] Logical statements and subseting data...

2008-02-25 Thread ONKELINX, Thierry
The negation of Height.1 == 0 & Height.2 == 0 was incorrect. Use subset(raw.all.clean, !(Height.1 == 0 & Height.2 == 0)) or subset(raw.all.clean, Height.1 != 0 | Height.2 != 0) HTH, Thierry ir. Thierry Onkelinx Inst

Re: [R] Logical statements and subseting data...

2008-02-25 Thread ONKELINX, Thierry
ronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Neil Shephard Verzonden: maandag 25 februari 2008 15:36 Aan: ONKELINX, Thierry CC: r-help Onderwerp: Re: [R] Logical statements and subseting data... Thanks Thierry, they do both leave me with what I expected. On Mon, Feb

Re: [R] ggplot2 boxplot confusion

2008-02-27 Thread ONKELINX, Thierry
Chris, 1. This code will give you the boxplot that you want. library(ggplot2) series <- c('C2','C4','C8','C10','C15','C20') ids <- c('ID1','ID2','ID3') mydata <- data.frame(SERIES=rep(series,30),ID=rep(ids,60),VALUE=rnorm(180)) ggplot(mydata, aes(y = VALUE, x = factor(1))) + geom_boxplot() + sc

Re: [R] how to specify ggplot2 facet plot order

2008-02-27 Thread ONKELINX, Thierry
Chris, The order of the facets row or column depend on the order in the associated factor. The code below is what you want. Note that I have changed 'cases' in 'series' because your example was not reproducible as a definition of 'cases' was missing. library(ggplot2) series <- c('C2','C4','C8','C

Re: [R] how to specify ggplot2 facet plot order

2008-02-27 Thread ONKELINX, Thierry
rry for the cut & paste error ... getting used to Xemacs on Windows. I used emacs years ago on Unix but now my environment is Windows. So far I find the Xemacs/Ess combo to be very powerful and flexible. Just need to get used to C-x C-c etc differences. ONKELINX, Thierry wrote: > > Chr

Re: [R] ggplot2 boxplot confusion

2008-02-27 Thread ONKELINX, Thierry
atures such as the position of the median, IQR etc. Or perhaps I've completely misunderstood your point (highly likely I think). Thanks again for your help. Much appreciated. ONKELINX, Thierry wrote: > > Chris, > > 1. > > This code will give you the boxplot that you w

Re: [R] ggplot2 boxplot confusion

2008-02-28 Thread ONKELINX, Thierry
seudo-ish code) for id, ser in ids, series: dat <- subset(mydata, (id %in% ids & ser %in% series) boxplot(dat) in grid position id, ser Can I specify grid plotting grid by grid with ggplot or do I need to look at lattice graphics? (I'd like to stick with ggplot if I can) ON

Re: [R] ggplot2 boxplot confusion

2008-02-29 Thread ONKELINX, Thierry
s here ... position="identity" AND x=dummy. Can I ask where you learned these things. I've read a lot of the online reference manual, "the book", other presentations of ggplot2 and don't recall seeing these, especially the x=dummy reference. Does this come from exper

Re: [R] handling big data set in R

2008-03-03 Thread ONKELINX, Thierry
Dear Shu, Why not store your dataset in a database? Then you can start each loop by reading the submatrix you need for the analysis. This will require much less memory. loops from the apply-family with work better than the for loop. HTH, Thierry -

Re: [R] ggplot2 - Problem with grid plot

2008-03-04 Thread ONKELINX, Thierry
Dear Chris, You'll need to add information on the facet factor (color) to the medians dataset. library(ggplot2) medians <- aggregate(diamonds$price, list(cut = diamonds$cut, color = diamonds$color), median) ggplot(data=diamonds, aes(x=price)) + geom_density(aes(color=cut)) + geom_vline(data=media

Re: [R] main title x title and y title with ggplot2

2008-03-05 Thread ONKELINX, Thierry
Guillaume, Have a look at the ggplot book on p. 29 (http://had.co.nz/ggplot2/book.pdf). HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometri

Re: [R] main title x title and y title with ggplot2

2008-03-05 Thread ONKELINX, Thierry
plot2 Thierry First thank you for the celerity of your response. Second I use ggplot2 like this : >ggplot(data, aes(x,y,fill)) + geom_point() + etc. Where did you your xlab and ylab when using ggplot2 like that? Guillaume 2008/3/5, ONKELINX, Thierry <[EMAIL PROTECTED]>: > > Guillaume

Re: [R] Updating packages from one hard-drive to another, after upgrade of R

2008-03-05 Thread ONKELINX, Thierry
Bob, You can copy the files from the packages to your new computer. Then run update.packages(checkBuilt = TRUE). That should do. HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research In

Re: [R] Trellis plots with two regression lines

2008-03-11 Thread ONKELINX, Thierry
Yvonne, With ggplot2 you could tackle this problem with the code below. library(ggplot2) graphs<- read.table("table.txt", header=T) ggplot(data = graphs, aes(x = bif, y = abund)) + geom_point() + geom_smooth(method = "lm") + facet_grid(. ~ experiment) Have a look at the ggplot2 website for more

Re: [R] How does one do simple string concatenation?

2008-03-17 Thread ONKELINX, Thierry
have a look at the collapse argument in ?paste. paste(paste(c("a","b","c"), collapse = ""), "d", sep = "")) HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and

Re: [R] Sweave, Bibtex, package references

2008-10-28 Thread ONKELINX, Thierry
Dear Paolo, Have a look at this thread: http://www.nabble.com/Automating-citations-in-Sweave-td20128175.html#a20 128175 HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute fo

Re: [R] Sweave, Bibtex, package references

2008-10-28 Thread ONKELINX, Thierry
-Oorspronkelijk bericht- Van: Paolo Sonego [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 28 oktober 2008 18:08 Aan: ONKELINX, Thierry CC: R-List Help - use this to post Onderwerp: Re: [R] Sweave, Bibtex, package references Dear Thierry, Thank you very much for you very useful advice! I

Re: [R] Incorrect order

2008-10-29 Thread ONKELINX, Thierry
Laura, Order works fine. The output tells you that the third element of a is the smallest, the first element is a second smallest, ... Try a[order(a)] that should be equal to sort(a). HTH, Thierry ir. Thierry Onkelin

Re: [R] ggplot2: histogram with proportions (or %)

2008-10-30 Thread ONKELINX, Thierry
Dear Bernd, AFAIK you can only get counts, densitys, counts scale to a maximum of 1 and likewise densitys. But you can alter the labels on the scales manually. library(ggplot2) dataset <- data.frame(x = rnorm(1000)) ggplot(dataset, aes(x = x)) + stat_bin(aes(y = ..ncount..)) ggplot(dataset, aes(x

Re: [R] getting "small" graphs with Sweave using Rnews.sty

2008-11-04 Thread ONKELINX, Thierry
Dear Jeff, Have you tried to insert the graph at the indended position? That is pasting <>= plot( rnorm( 100 ) ) @ At the location of A graph goes here So the code would be \begin{figure} \vspace*{.1in} \framebox[\textwidth]{\hfill \raisebox{-.45in}{\rule{0in}{1in}} <>= plot( rnorm( 100 ) ) @

Re: [R] Reshape a matrix

2008-11-06 Thread ONKELINX, Thierry
Dear Dinesh, Have a look at ?cast for the reshape package > dataset <- data.frame(Col1 = LETTERS[1:3], Col2 = sort(rev(LETTERS)[1:3]), value = 1:3) > dataset Col1 Col2 value 1AX 1 2BY 2 3CZ 3 > library(reshape) > cast(Col1 ~ Col2, data = dataset, fill = 0)

Re: [R] plotting graph in different device

2008-11-10 Thread ONKELINX, Thierry
First open the device, then plot x11() plot(A5e$ECAB,A5e$EXPEND,type='p',main='Per capita expenditure against economic ability index without liners',xlab='ECAB',ylab='EXPEND',xlim=c(0,150),ylim=c(150,400), col='red',col.axis='blue') HTH, Thierry -

Re: [R] ggplot2 - two or more axis

2008-11-17 Thread ONKELINX, Thierry
Dear David, You could put the numbers on the graph with geom_text() HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en

Re: [R] Elegant way to transform dataframe?

2008-11-20 Thread ONKELINX, Thierry
Dear Barry, Have a look at the function cast() in the reshape package. That should be able to do what you need. HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature

Re: [R] repeated measures regression and power analysis?

2008-11-25 Thread ONKELINX, Thierry
Dear Jake, Have a look at glmer in the lme4 package. The will allow you to model the trend with repeated measurements. The easiest way to do some power analysis for repeated measurement will probably be by simulation. HTH, Thierry --

Re: [R] lme4 and false convergence

2008-11-25 Thread ONKELINX, Thierry
Dear Ben, Your questions suite better in R-SIG-Mixed-Models which I am cc'ing. Have checked the mailing list? Try RSiteSearch("lme4 false convergence") HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en boso

Re: [R] lmer refuses nested random factors

2008-11-27 Thread ONKELINX, Thierry
Dear Martin, How many levels has PLANT? Does it is an ID for the individual plants? In that case it is pointless to add it to a random effect. Because then each group at the higest level would contain only one observation. There is a mailing list dedicated to mixed effects models: R-Sig-mixed-m

Re: [R] ggplot2 facet_wrap problem

2008-12-02 Thread ONKELINX, Thierry
Hi Stephen, I think you will need to clarify what your problem is with the second plot. HTH, Thierry -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] namens stephen sefick Verzonden: di 2-12-2008 22:52 Aan: hadley wickham; R-help Onderwerp: [R] ggplot2 facet_wrap problem Hadley, I don

Re: [R] ggplot2 45deg axis labels

2008-12-02 Thread ONKELINX, Thierry
Hi Stephen, Have a look at the ggplot2 book. You will find an example on p. 6 of http://had.co.nz/ggplot2/book/polishing.pdf HTH, Thierry -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] namens stephen sefick Verzonden: wo 3-12-2008 0:31 Aan: R-help Onderwerp: [R] ggplot2 45deg axis la

<    1   2   3   4   5   6   7   >