[R] stopping functions with long execution times

2013-07-18 Thread ONKELINX, Thierry
Dear all, I am running the same model on several datasets, each dataset is a different species. The problem is that for some datasets the model is not converging. Currently I have an INLA model running for 35 days and still no results. The process still uses near 100% of the CPU and less than 1

Re: [R] stopping functions with long execution times

2013-07-18 Thread ONKELINX, Thierry
k.bengts...@gmail.com] Namens Henrik Bengtsson Verzonden: donderdag 18 juli 2013 12:43 Aan: ONKELINX, Thierry CC: r-help@r-project.org Onderwerp: Re: [R] stopping functions with long execution times See evalWithTimeout() of R.utils, e.g. tryCatch({ evalWithTimeout({ slowFunction(); }, timeout=7

Re: [R] Help to improve prediction from supervised mapping using kohonen package

2013-07-24 Thread ONKELINX, Thierry
Try rescaling your data prior to splitting it up into a training and test set. Otherwise you end up with two different ways of scaling. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quali

Re: [R] GGplot 2 – cannot get histogram and box plot axis to match.

2013-07-26 Thread ONKELINX, Thierry
Dear John, Use xlim() and ylim() instead of expand_limits() library(ggplot2) #sample data from ggplot2 data(Cars93, package = "MASS") dataSet <- Cars93 #variables to calculate the range to extend the axis dataVector <- unlist(dataSet[,"MPG.city"]) dataRange <- diff(range(dataSet$MPG.city)) g

Re: [R] lme (weights) and glht

2013-07-26 Thread ONKELINX, Thierry
Dear Sibylle, Have you tried to create a new variable? ME$fDiversity <- factor(ME$Diversity) H08_lme <- lme( log(Height2008_mean) ~ fDiversity, data = ME, random = ~ 1|Plot/SubPlot, weights = varPower(form = ~Diversity), na.action = na.omit, subset = ME$Species == "Ace_pse", method = "ML" ) summ

Re: [R] Varying statistical significance in estimates of linear model

2013-08-08 Thread ONKELINX, Thierry
Dear Stathis, I recommend that you try to get some advice from a local statistician or read an introductory book on statistics. This kind of question is beyond the scope of a mailing list. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature

Re: [R] linking to help pages in other packages

2013-08-09 Thread ONKELINX, Thierry
Dear Jannis, I think you want \link[package]{function} instead of \link[package:function]{function} \link[Rssa]{ssa} Best regards, Thierry Van: r-help-boun...@r-project.org [r-help-boun...@r-project.org] namens Jannis [bt_jan...@yahoo.de] Verzonden: vr

Re: [R] Lme4 and syntax of random factors

2013-08-14 Thread ONKELINX, Thierry
Dear Robert, (1|A/B) is shorthand for (1|A) + (1|A:B) ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525 02 51 + 32 54 43

Re: [R] Double return statement

2013-08-14 Thread ONKELINX, Thierry
Dear Katherine, Combine both outputs in a list and return that. return(list(first = output.1, second = output.2)) Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Ass

Re: [R] arbitrary subset of dataframe

2013-08-26 Thread ONKELINX, Thierry
You've misplaced the comma. mysample <- df[, sample(ncol(df), 50, replace=FALSE)] ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium

Re: [R] SimpleR

2013-08-27 Thread ONKELINX, Thierry
I think you want the UsingR package ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525 02 51 + 32 54 43 61 85 thierry.onkel

Re: [R] Sweave: printing an underscore in the output from an R command

2013-09-02 Thread ONKELINX, Thierry
You have to escape the underscore \Sexpr{gsub("_", "\_", print(version$platform))} Best regards, Thierry Van: r-help-boun...@r-project.org [r-help-boun...@r-project.org] namens David Epstein [david.epst...@warwick.ac.uk] Verzonden: maandag 2 september 2

Re: [R] S3 Methods for Linear Regression

2013-09-09 Thread ONKELINX, Thierry
Dear Harold, An easy work-around would be to pass the names of the variables as a character vector. fm <- lm.eiv(y ~ x1 + x2, dat, ind = c(2,3), semDep = 0, semMat = c("sem1", "sem2")) And the change your lm.eiv.fit accordingly. Or you could have a look at the .() function of the plyr package

Re: [R] column selection

2013-01-02 Thread ONKELINX, Thierry
You have two options. Q[, 117:ncol(Q)] Or using the negation, thus not selecting the first 116 cols. Q[, -1:-116] ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Klini

Re: [R] to check if a character string is in a group of character strings

2013-01-23 Thread ONKELINX, Thierry
I think you want %in% subpool %in% pool pool %in% subpool ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525 02 51 + 32

Re: [R] urgent: question concerning data manipulation

2013-03-04 Thread ONKELINX, Thierry
Have a look at cast() from the reshape package. library(reshape) cast(personId ~ law, data = testdata, value = "article", fun = length) cast(personId ~ law, data = testdata, value = "article", fun = function(x){1 * (length(x) > 0)}) Van: r-help-boun...@r-

Re: [R] Color spalettes for black/white printing

2013-03-05 Thread ONKELINX, Thierry
Have a look at bpy.colors() Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525 02 51 + 32 54 43 61 85 thierr

Re: [R] combining column having same values

2013-03-06 Thread ONKELINX, Thierry
Dear Eliza, You question is not very clear. I think you are looking for the which() function. Best regards, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Klin

Re: [R] Ggplot2: Moving legend, change fill and removal of space between plots when using grid.arrange() possible use of facet_grid?

2013-03-06 Thread ONKELINX, Thierry
Dear Anna, Is this what you would like? Summ <- ddply(mydata, .(factor3,factor1), summarize, mean = mean(var1, na.rm = FALSE), sdv = sd(var1, na.rm = FALSE), se = 1.96*(sd(var1, na.rm=FALSE)/sqrt(length(var1 Summ$Grouping

Re: [R] A==A false?

2013-03-07 Thread ONKELINX, Thierry
FAQ 7.31 ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525 02 51 + 32 54 43 61 85 thierry.onkel...@inbo.be www.inbo.be To

Re: [R] RStudio and R version 3.0

2013-04-05 Thread ONKELINX, Thierry
Dear John, According to the Rstudio website you need the latest version of Rstudio to work with R 3.0.0. I had the same problem yesterday (on WinXP). Installing the latest Rstudio solved it. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Natu

Re: [R] R crash

2013-04-10 Thread ONKELINX, Thierry
Have a look at the warning in ?geepack::geeglm It should be mentioned in ?geepack::geese as well. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 And

Re: [R] nearest stations in distance matrix

2013-04-15 Thread ONKELINX, Thierry
Dear Eliza, If you have the coordinates of the stations you can use the nnwhich() function from the spatstat package. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality

Re: [R] 4253H twice implementation

2012-10-22 Thread ONKELINX, Thierry
Have a look at library(sos) findFn("twice filter") ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525 02 51 + 32 54 43 61

Re: [R] help with lme

2012-10-30 Thread ONKELINX, Thierry
Dear Sylvia, R-sig-mixed-models is a better list for questions about mixed models. The summary gives you the standard error for the fixed effects. See the output in your mail. E.g. AGQ has a standard error of 0.044 Have a look at http://glmm.wikidot.com/faq, it covers some topics on mixed mode

Re: [R] newbie: embeding seq in a list

2012-10-30 Thread ONKELINX, Thierry
You first example is a list of 5 items, each item is a number The second example is a list with one item: a vector with 5 elements. You'll need c() to make a vector of the item to get the same result. all.equal(list(c(0.8,0.9,1.0,1.1,1.2)), list(seq(0.8, 1.2, by = 1.1))) ir. Thierry Onkelinx Inst

Re: [R] ggplot2: using coord_trans for logit -> probability

2014-04-17 Thread ONKELINX, Thierry
Dear Michael, You can use geom_smooth directly. ggplot(pred, aes(x = Age, y = Better)) + geom_smooth(method = "glm", family = binomial) Best regards, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg

Re: [R] Fw: Save multiple plots as pdf or jpeg

2014-04-23 Thread ONKELINX, Thierry
Have a look at the knitr package. http://yihui.name/knitr/demo/minimal/ Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belg

Re: [R] why does it say all the cases are complete?

2014-04-25 Thread ONKELINX, Thierry
You have no missing data. Note that the string "" is not missing! You need to code missings as NA. Have look at ?is.na ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Klin

Re: [R] lme4 Error Help: “maxstephalfit…pwrssUpdate”

2014-04-27 Thread ONKELINX, Thierry
Dear Craig, It is better to ask questions about lme4 at r-sig-mixed-models (in cc). Are you using a recent version of lme4? Try upgrading lme4 and see if you still get the error. Best regards, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature

Re: [R] linear mixed model for non-normal negative and continous data

2014-04-28 Thread ONKELINX, Thierry
Dear Caroline, Check the homogeneity of the variances. If they are inhomogeneous, you can add a variance function to deal with it. However, you will need to switch to the lme() from the nlme package. Best regards, Thierry PS R-Sig-mixed-models is a better list for this kind of questions. ir.

Re: [R] stop a function

2014-05-13 Thread ONKELINX, Thierry
Have a look at evalWithTimeout() from the R.utils package Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525

Re: [R] stop a function

2014-05-14 Thread ONKELINX, Thierry
insdag 13 mei 2014 22:13 Aan: ONKELINX, Thierry; r-packages-ow...@r-project.org; r-help@r-project.org; r-help-requ...@r-project.org Onderwerp: Re: [R] stop a function Hi, Another problem arised now. I got this error: Error in match(x, table, nomatch = 0L) : reached CPU time limit I googled it

Re: [R] Subsets of a function

2014-05-20 Thread ONKELINX, Thierry
Another option is the plyr package. library(plyr) result <- dlply(size, ~ Year +Season, function(.sub){ with(.sub, smooth.spline(Size, Prop, spar = 0.25)) } ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteits

Re: [R] Identifying one or more TRUE in the middle of an array

2014-06-06 Thread ONKELINX, Thierry
Here is my solution. falses <- which(!x) first.false <- head(falses, 1) last.false <- tail(falses, 1) which(x[first.false:last.false]) + first.false - 1 Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwalite

Re: [R] aov + pairwise.t.test: only selected pairs

2014-06-11 Thread ONKELINX, Thierry
Have a look at the multcomp package. The examples in glht() demonstrate how to specify the required contrasts. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assuran

Re: [R] help in writing an R-function for Residual correlated structures

2014-06-12 Thread ONKELINX, Thierry
R works faster if you can avoid loops the loops. There is an example. Note that it required global variables (like your function). You better avoid that. rspat <- function(rhox, rhoy, s2e = 1){ require(matlab) R <- s2e * eye(N) i <- rep(seq_len(N), each = N) j <- rep(seq_len(N), N) j <-

Re: [R] Publication-ready figures with two plots

2014-06-19 Thread ONKELINX, Thierry
Dear Adam, ggsave() works only with single ggplot object. You need the standard R way of saving those plots. 1) open a suitable device 2) plot the figures 3) close the device tiff(filename = "Figure 1.tiff", scale = 1, width = 10, height = 5, units = "cm", dpi = 300) grid.arrange(plot1, plot2,

Re: [R] issues with krige function

2012-10-31 Thread ONKELINX, Thierry
Dear Adrienne, What is the output of summary(casestudy) and summary(gridmeta)? What happens if you set nmax to 10? krige(formula=bias~1,locations=~lon+lat,data=casedata,newdata=gridmeta ,model=v.fit, nmax = 10) ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for

[R] averaging a list of matrices element wise

2012-11-05 Thread ONKELINX, Thierry
Dear all, I have a list of n matrices which all have the same dimension (r x s). What would be a fast/elegant way to calculate the element wise average? So result[1, 1] <- mean(c(raw[[1]][1, 1] , raw[[2]][1, 1], raw[[...]][1, 1], raw[[n]][1, 1])) Here is my attempt. #create a dummy dataset n <

Re: [R] averaging a list of matrices element wise

2012-11-06 Thread ONKELINX, Thierry
ey -Oorspronkelijk bericht- Van: Bert Gunter [mailto:gunter.ber...@gene.com] Verzonden: maandag 5 november 2012 16:13 Aan: D. Rizopoulos CC: ONKELINX, Thierry; r-help@r-project.org Onderwerp: Re: [R] averaging a list of matrices element wise Gents: Although it is difficult to say what may be

Re: [R] total number of citations for R project

2012-11-07 Thread ONKELINX, Thierry
http://scholar.google.be/scholar?q=www.R-project.org&btnG=&hl=nl&as_sdt=0 http://scholar.google.be/scholar?q=%22R+Core+Team%22&btnG=&hl=nl&as_sdt=0 http://scholar.google.be/scholar?q=%22R+Foundation+for+Statistical+Computing%22&btnG=&hl=nl&as_sdt=0 ir. Thierry Onkelinx Instituut voor natuur- en

Re: [R] A warning message in glht

2012-11-08 Thread ONKELINX, Thierry
Dear Yulia, When you have an interaction between a continuous and a categorical variable, then the multiple comparison on the categorical variabel makes only sense conditional that the continuous variable is zero. Hence the warning. Best regards, Thierry ir. Thierry Onkelinx Instituut voor na

Re: [R] A panel of contour plots through a iteration process

2012-11-08 Thread ONKELINX, Thierry
I would rather use facet_wrap() instead of multiplot() Just combine all your data in one data.frame and make sure that you have a variable indication the iteration. library(reshape2) volcano3d <- melt(volcano) names(volcano3d) = c("x", "y", "z") volcano3d <- merge(volcano3d, data.frame(Iteration

Re: [R] A panel of contour plots through a iteration process

2012-11-09 Thread ONKELINX, Thierry
Van: Loukia Spineli [mailto:spinelilouki...@gmail.com] Verzonden: vrijdag 9 november 2012 12:06 Aan: Jose Iparraguirre CC: ONKELINX, Thierry; r-help@r-project.org help Onderwerp: Re: [R] A panel of contour plots through a iteration process Hm, the problem is a little bit more complicated than I thought. L

Re: [R] aggrete data from combination

2012-11-14 Thread ONKELINX, Thierry
You can use combn(100, 2) to generate the combinations of the plots. It is not clear to me what you want to do with the diameters. You have 4 diameter for plot 1 and 2 for plot 2. What should the output look like? ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute f

Re: [R] aggrete data from combination

2012-11-14 Thread ONKELINX, Thierry
Please be more specific about what you want. Give an example of the required output. And keep the mailing list in cc when replying. Van: catalin roibu [catalinro...@gmail.com] Verzonden: woensdag 14 november 2012 17:54 Aan: ONKELINX, Thierry Onderwerp: Re: [R

[R] puzzling RODBC error

2012-11-26 Thread ONKELINX, Thierry
Dear all, I'm trying to connect to an MSAccess database (ArcGIS personal geodatabase). I keep getting an error about the channel when using sqlQuery(). However, sqlTables() does not complain about the channel and lists all tables in the database. If I try sqlFetch(), then R crashes. I'm happy

Re: [R] puzzling RODBC error

2012-12-06 Thread ONKELINX, Thierry
Dear all, Thanks to Marc and Bart for looking in to this. It turns out to be due to a typo of me: I misspelled channel. Best regards, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometric

Re: [R] help with predict.glm, and charting with factors

2012-12-12 Thread ONKELINX, Thierry
Dear Chad, Did you post your entire dataset? If so: 1) your model is too complex for the amount of data you have. See the quotes below... 2) There is complete separation, leading to large parameter estimates and fits very close to 0 and 1 (in terms of probabilities) 3) You fit temperature as a

[R] Problem loading .Rdata file

2012-12-14 Thread ONKELINX, Thierry
Dear all, I'm having troubles migrating a large matrix from one system to another. #system 1: Ubuntu 12.04, 64-bit, running R 2.15.2 # do some simulations # save the simulations > save(Output, file = "Simulations.Rdata") #Output is a numeric matrix with 6 columns and about 2M rows. Use ftp to tr

Re: [R] ggplot2: stat_smooth for family=binomial with cbind(Y, N) formula

2013-12-17 Thread ONKELINX, Thierry
Dear Michael, Calculate the propotions. Then it is easy to use the weight option of glm data("SpaceShuttle", package="vcd") SpaceShuttle$trials <- 6 fm <- glm(cbind(nFailures, 6 - nFailures) ~ Temperature, data = SpaceShuttle, family = binomial) fm2 <- glm(nFailures/trials ~ Temperature, data =

Re: [R] ggplot2: stat_smooth for family=binomial with cbind(Y, N) formula

2013-12-17 Thread ONKELINX, Thierry
, Thierry Van: Michael Friendly [frien...@yorku.ca] Verzonden: dinsdag 17 december 2013 19:42 Aan: ONKELINX, Thierry; R-help Onderwerp: Re: [R] ggplot2: stat_smooth for family=binomial with cbind(Y, N) formula Thanks very much for this helpful reply, Thierry Using aes(wei

Re: [R] ifelse...

2014-01-16 Thread ONKELINX, Thierry
You want y <- ifelse(x == 'a', 1, 2) ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525 02 51 + 32 54 43 61 85 thierry.onk

Re: [R] Overlaying two graphs using ggplot2 in R

2014-01-28 Thread ONKELINX, Thierry
Dear Kristi, You could do something like this. ggplot(dat1, aes(x = factor(site), y = Present)) + geom_boxplot(aes(colour = layer)) + geom_line(data = dat2, aes(group = 1, y = present)) + geom_point(data = dat2, aes(y = present)) Note that - ggplot provides no second axis - the boxplots di

Re: [R] Publication-ready figures in R?

2014-01-28 Thread ONKELINX, Thierry
Dear Dan, Have a look at ggplot2. It allows to define themes. I've create two theme for our institution: one according our internal styling guide, one according to the styling guide for Elsevier journal. Applying the Elsevier theme to all plots in a script requires just adding theme_set(theme_e

Re: [R] princomp/prcomp packages not available for 3.0.2

2014-02-19 Thread ONKELINX, Thierry
Both are functions (not packages) and available in the stats package. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525 02

Re: [R] boxcox alternative

2014-02-24 Thread ONKELINX, Thierry
Dear Michael. The normality of _covariates_ is seldom relevant. The relevance of normality of the _response variable_ depends on the model assumptions. In case of linear models the only the **residuals** (and not the responses) are assumed to be normally distributed. Transformation of response

Re: [R] shapes of woodpeckers' cavities

2014-03-07 Thread ONKELINX, Thierry
Dear Violette, Search for elliptical Fourier analysis. RSiteSearch("elliptical fourier analysis") Best regards, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance

[R] UTF-8 characters in pandoc template variables using knitr

2014-03-13 Thread ONKELINX, Thierry
Dear all, Consider the simpel RMarkdown file below. I've saved it as test.md with UTF-8 encoding. Notice that I have embedded a custom pandoc variable 'test' in the file. This variable holds an UTF-8 character ©. %My title %The authorslist # First section fgsdfg jsdksdfgsdfg Now I try to com

Re: [R] data.table and R package check

2014-03-17 Thread ONKELINX, Thierry
This is workaround by defining the 'global variables' as NULL. Use it with caution. ### Fooling R CMD check transition_group_id <- NULL ### Fooling R CMD check setkey(aligtable,transition_group_id,align_origfilename) ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institu

Re: [R] Save P values calculated with anova

2013-11-04 Thread ONKELINX, Thierry
You'll need to add quotes MyAnova$"Pr(>F)" Or use the bracket notation MyAnova[, "Pr(>F)"] ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderl

Re: [R] Problem while reading Data from a data frame

2013-11-05 Thread ONKELINX, Thierry
You don't need a loop nor a growing object. data(mtcars) mtcars mtcars[seq(1, nrow(mtcars), by = 2), ] ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 107

Re: [R] Anova split by factors

2013-11-18 Thread ONKELINX, Thierry
Dear Catalin, Have a look at the plyr package. library(plyr) dlply( eg, .(Exp), function(x) { aov(masa.uscat.tr~Clona,data=x) } ) Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest

Re: [R] Sending a matrix in an email

2013-11-18 Thread ONKELINX, Thierry
Have you tried dput(your.matrix)? ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525 02 51 + 32 54 43 61 85 thierry.onkel..

Re: [R] lmer specification for random effects: contradictory reults

2013-11-25 Thread ONKELINX, Thierry
Dear Benedetta, I think you might want (1+T+Z|subject) as random effects rather than (1+T|subject) + (1 + Z|subject). The latter has two random intercepts per subject: a recipe for disaster. Follow-up posts should only go to the mixed models mailing list which I'm cc'ing. Best regards, ir.

Re: [R] qplot

2010-06-17 Thread ONKELINX, Thierry
Dear Line, Have at look at ?scale_colour_manual() HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute

Re: [R] Multiline and grouping in R

2010-06-30 Thread ONKELINX, Thierry
Or you could use ggplot2 library(ggplot2) Dataset <- read.csv("file.csv", header=TRUE) ggplot(Dataset, aes(x = YEAR, y = CASES, colour = AREA)) + geom_line() HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- e

Re: [R] repeated measures with missing data

2010-07-05 Thread ONKELINX, Thierry
Dear Rafael, The line below had one closing bracket to much. The line below should work. am2 <- lmer(dv ~ myfactor + (1|subject), data = mydata) Furthermore I would advise to change myfactor for a character variable to a factor. HTH, Thierry --

Re: [R] data arranged by p-values

2010-07-26 Thread ONKELINX, Thierry
Have a look at ?cumsum. Apply that on a true/false vector (p-value > 0.05) ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research I

Re: [R] Plot of a subset of a data.frame()

2010-07-26 Thread ONKELINX, Thierry
You could have a look at the ggplot2 package to make such plots. The code for the plots is more readable than with base plots. a = c(1:10) # create a vector of integers b = rep(c("a","b"),5) # create a vector of chars, used # as factor-levels d = rnorm(10) # some ran

Re: [R] (no subject)

2010-09-10 Thread ONKELINX, Thierry
Have a look at the ggplot2 package install.packages("ggplot2") library(ggplot2) ggplot(data, aes(x = sex, y = income, fill = occupation)) + geom_bar(position = "dodge") Have a look at http://had.co.nz/ggplot2/ for more information and examples. HTH, Thierry --

Re: [R] plotting time series using ggplots

2010-09-16 Thread ONKELINX, Thierry
Dear Alison, Creating a dataset in long format instead of wide format makes things much easier with ggplot2. You also need a variable with Year. Rownames will not do. rwl <- matrix(rnorm(800, 1, sd =0.5), nrow = 100) colnames(rwl) <- paste('V', 1:8, sep = '') rwl <- as.data.frame(rwl) rwl$Year <-

Re: [R] Pesky homemade function code

2010-09-16 Thread ONKELINX, Thierry
The calculation of semivraiogram is allready implemented is many R packages. So why do it yourself? library("sos") findFn("variogram") Gives you 190 hits! ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek tea

Re: [R] standard error of difference for mixed effects

2010-09-16 Thread ONKELINX, Thierry
Dear Tony, A mixed models is not a good idea if you have only two levels for sites and two times two for phase. The first problem is a mathematical problems. You are estimating variances based on only two and four values. Which is very small, hence you will not get reliable estimates of the va

Re: [R] ggplot2 - bar colour

2010-09-20 Thread ONKELINX, Thierry
If you want to change the fill colours, then you need to specify fill instead of colour ggplot(ageincgraph, aes(x = age, y = rate, fill = era)) + geom_bar(position = "dodge", stat = "identity") + scale_fill_manual(values=c("red","orange","yellow")) --

Re: [R] ggplot2 - bar colour

2010-09-20 Thread ONKELINX, Thierry
Textures are currently not possible in ggplot2. Because grid does not support them. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium R

Re: [R] how to show the number of each axis interval (plot)

2010-09-20 Thread ONKELINX, Thierry
Have a look at ?axis ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics & Quali

Re: [R] removed data is still there!

2010-09-21 Thread ONKELINX, Thierry
Removing elements from a factor does not change the levels of the factor. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research In

Re: [R] plot xyz data in 2D

2010-09-21 Thread ONKELINX, Thierry
Dear Jacob, Do you want something like this? Using dummy data instead of yours. Copy-paste the output of dput() if you want to pass your data in a format that is easy to use. library(ggplot2) dataset <- expand.grid(X = -3:3, Depth = seq(0, -1, by = -0.25)) dataset$Resistivity <- rnorm(nrow(datase

Re: [R] Doing operations by grouping variable

2010-09-23 Thread ONKELINX, Thierry
Another option for doing opertions by grouping variables is to the the plyr package. d <- data.frame(x=1:10, g1=LETTERS[rep(11:12,each=5)], g2=letters[rep(21:23,c(3,3,4))] ) library(plyr) ddply(d, c("g1", "g2"), function(z){ z$x <- z$x / max(z$x) z

Re: [R] Ordinal mixed model

2010-09-23 Thread ONKELINX, Thierry
Dear Patrick, You can fit such a model with the MCMCglmm package. Have a look at the vignette of that package. install.packages("MCMCglmm") vignette("CourseNotes", package = "MCMCglmm") But I'm affraid that this will require some rockclimbing upon the learning curve if you are a R novice. HTH

Re: [R] Controling R from MS Access

2010-09-30 Thread ONKELINX, Thierry
Dear Felipe, In the past I have done something similar. I had Access to run an R script in batch mode. The script reads data from Access, processes the data and puts data back in Access tables. The user hit a button in Access and see a blank console window popping up. When the console window d

Re: [R] is there a way to avoid "traveling" grid?

2010-10-05 Thread ONKELINX, Thierry
Dear Dimitri, Ggplot2 solves your problem with the gridlines and requires much less code. You only need to reshape your data somewhat. library(ggplot2) #changing the dataset my.data2 <- my.data my.data2$x <- my.data$x + my.data$a my.data2$z <- my.data$y + my.data$z Molten2 <- melt(my.data2, id.va

Re: [R] is there a way to avoid "traveling" grid?

2010-10-07 Thread ONKELINX, Thierry
t a reasonable answer can be extracted from a given body of data. ~ John Tukey > -Oorspronkelijk bericht- > Van: Dimitri Liakhovitski [mailto:dimitri.liakhovit...@gmail.com] > Verzonden: dinsdag 5 oktober 2010 17:49 > Aan: ONKELINX, Thierry > CC: r-help@r-project.org >

Re: [R] Count values in a dataframe with respect to groups

2010-10-08 Thread ONKELINX, Thierry
Have a look at table table(na.omit(dta)$grp) Untested! ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Natur

Re: [R] Split rows depending on time frame

2010-10-11 Thread ONKELINX, Thierry
Dear Bert, Use the plyr package to do the magic library(plyr) dataset <- data.frame(COL1 = c("A", "B"), COL2 = 40462, COL3 = c(40482, 40478)) tmp <- ddply(dataset, "COL1", function(x){ delta <- with(x, 1 + COL3 - COL2) rows <- rep(1, delta %/% 7) if(delta %% 7 > 0){

Re: [R] help with simple but massive data transformation

2010-10-11 Thread ONKELINX, Thierry
This should be easy with apply() do.call(rbind, apply(dataset, 1, function(x){ list(data.frame(startend = x[1]:x[2], value = x[3]) })) Untested! ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team

Re: [R] Factors in an regression using lm()

2010-10-12 Thread ONKELINX, Thierry
The problem is not in the covariates but in the respons variable. lm() can only handle numerical variables. Deny is a factor, hence you get an error. HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonder

Re: [R] Linear Regression

2010-10-12 Thread ONKELINX, Thierry
Dear Vittorio, Notice that anova(regress) gives a warning: ANOVA F-tests on an essentially perfect fit are unreliable Maybe summary(regress) should give a similar warning in case of a perfect fit. Allthough you should notice that the residual standard error displayed by summary() is extremly smal

Re: [R] F cumulative distribution function

2010-10-12 Thread ONKELINX, Thierry
Have a look at qf() and pf() HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest

Re: [R] ggplot output

2010-11-04 Thread ONKELINX, Thierry
The easiest way it to create one long dataset with four variables: Month, avg, stdev and type. Type will be either K, C or S. Then you just need to add some facetting to your code ggplot(data = dat, aes(x = Month, y = avg, ymin = avg - stdev, ymax = avg + stdev)) + geom_point() + geom_line()

Re: [R] ggplot output

2010-11-04 Thread ONKELINX, Thierry
Split.screen() and par() don't work with ggplot2 ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Fo

Re: [R] ggplot output

2010-11-04 Thread ONKELINX, Thierry
Have a look at the ggplot2 website. It has a lot of examples http://had.co.nz/ggplot2/ look at the bottom of this page for facet_grid() and facet_wrap() http://had.co.nz/ggplot2/facet_wrap.html direct link to facet_wrap() --

Re: [R] table with values as dots in increasing sizes

2010-11-05 Thread ONKELINX, Thierry
> install.packages("fortunes") > library(fortunes) > fortune("yoda") Evelyn Hall: I would like to know how (if) I can extract some of the information from the summary of my nlme. Simon Blomberg: This is R. There is no if. Only how. -- Evelyn Hall and Simon 'Yoda' Blomberg R-help (April 20

Re: [R] how to find near neighbors?

2010-11-18 Thread ONKELINX, Thierry
Have a look at nncross() from the spatstat package. Best regards, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research

Re: [R] Question on overdispersion

2010-11-19 Thread ONKELINX, Thierry
Dear Nameless, The quasi distribution can no longer be used in lme4 because a) the results were not very reliable b) there is an alternative to model overdispersion. The alternative is to expand your dataset to bernoulli trials. Then add a random effect with one level per observation. This random

Re: [R] Prob with merge

2010-11-22 Thread ONKELINX, Thierry
merge(t1,t2, by="a", all.x = TRUE) ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biom

Re: [R] ggplot2 histograms

2010-11-30 Thread ONKELINX, Thierry
Dear Sandy, Have a look at the position argument of geom_histogram. ggplot(data=dafr, aes(x = d1, fill=d2)) + geom_histogram(binwidth = 1, position = position_dodge()) ggplot(data=dafr, aes(x = d1, fill=d2)) + geom_histogram(binwidth = 1, position = position_dodge(width = 0.5), alpha = 0.5) Best

Re: [R] Adding lines in ggplot2

2011-01-05 Thread ONKELINX, Thierry
Dear Eduardo, This a solution that you seem to want n <- 1:10 x <- sqrt(n) y <- log(n) qplot(n, x, geom="line", colour="darkgreen") + geom_line(data = data.frame(n , x = y), colour="red") But please compare it with the solution (code + result) below. Formatting the data.frame might be a bit more

<    1   2   3   4   5   6   7   >