[R] Exact String Compare in R?

2009-11-03 Thread bamsel
Dear R users: Here's a barebones example of what I can't make work. As you can see, regexpr() does not perform an exact string match, which only occurs in row 1 of these data frames. Instead, as it's supposed to do, it finds b in bb and c in cc. Does anybody know what function I can use such

[R] exact string match?

2009-10-30 Thread bamsel
Dear R users: I need to compare character strings stored in 2 separate data frames. I need an exact match, so finding a in animal is no good. I've tried regexpr, match, and grepl, but to no avail. Anybody know how to accomplish this? Ben -- View this message in context:

[R] Data frame column name as function argument?

2009-09-22 Thread bamsel
Any help is very much appreciated. The following is a toy example: #1. Create a data frame with two named columns (x,y): DF - data.frame(cbind(x=1:5, y=6:10)) DF x y 1 1 6 2 2 7 3 3 8 4 4 9 5 5 10 #2. Define a function to compute the sum of a given column: foo.fnc = function(i){

[R] Syntax for crossed random effects in nlme

2009-09-01 Thread bamsel
Hello R users, I've read the posts on this topic, and had a look at the R documentation for nlme, but I can't seem to make this work. I'd like to be able to fit a mixed effects model with crossed random effects, but also be able to specify the covariance matrix structure for the residuals.

[R] Alternate error structures in lme4?

2009-06-26 Thread bamsel
Hi R users, The nlme library enabled several alternate error structures useful for longitudinal or repeated-measures data. For example, a continuous AR(1) process: model_2 = update(model_1, correlation = corCAR1(form = ~ time | subject)) Does anybody know if this is available in lme4? Thank