Re: [R] Multilevel model in lme4 and nlme

2011-09-13 Thread jonas garcia
(y ~ x, random=list(a=~1, b=~1, c=~1), data=mydata) mod2.lmer- lmer(y ~ x + (1|a) + (1|a:b) + (1|a:b:c), data=mydata) My objective is to specify mod1 using function lme. Anyone knows how to do it? Thanks J On Mon, Sep 12, 2011 at 9:43 PM, Ben Bolker bbol...@gmail.com wrote: jonas

[R] Multilevel model in lme4 and nlme

2011-09-12 Thread jonas garcia
Dear list, I am trying to fit some mixed models using packages lme4 and nlme. I did the model selection using lmer but I suspect that I may have some autocorrelation going on in my data so I would like to have a look using the handy correlation structures available in nlme. The problem is

Re: [R] calculate area between intersecting polygons

2010-10-27 Thread jonas garcia
Many thanks for your help! Thanks to you guys I manage to solve my problem in an efficient way All the best J On Tue, Oct 26, 2010 at 11:04 PM, Remko Duursma remkoduur...@gmail.comwrote: I don't know why I forgot that you can do this as well : area.poly(intersect(p1,p2)) ... a bit more

Re: [R] calculate area between intersecting polygons

2010-10-26 Thread jonas garcia
Thanks for your reply, My main issue is that I don't have any equations to generate the data, just a bunch of points, each corresponding to a polygon. I was looking in package sp and there is a function to calculate areas ( areapl()), but not for intersecting polygons. Is there any other package

[R] calculate area between intersecting polygons

2010-10-25 Thread jonas garcia
Dear list: I am trying to calculate the intersection area between two irregular polygons (see example data below). set.seed(1234) theta - seq(0, 2 * pi, length=(100)) poly1- cbind(c(0 + 1 * cos(theta) + rnorm(100, sd=0.1)), c(0 + 2 * sin(theta))) poly2- cbind(c(0 + 2 * cos(theta) ),

[R] help identifying clusters

2010-10-20 Thread jonas garcia
Dear list: I have a dataset of geographical data that looks like this example data: dat- data.frame( lon = c(rnorm(1000, mean=-10), rnorm(1000, mean=10), rnorm(1000, mean=5)), lat = c(rnorm(1000, mean=40), rnorm(1000, mean=30), rnorm(1000, mean=0))) plot(dat$lon, dat$lat) My positions are

Re: [R] End of line marker?

2010-03-05 Thread jonas garcia
: On 04/03/2010 10:32 PM, David Winsemius wrote: On Mar 4, 2010, at 9:47 PM, jonas garcia wrote: When I opened the file with a hex-editor, the problematic character turned out to be “1a” I am attaching a sample DAT file with 3 lines (the second line is the one with the undesirable character

Re: [R] End of line marker?

2010-03-04 Thread jonas garcia
to go for text editors separately. Help on this would be much appreciated. Thanks again J On 3/4/10, David Winsemius dwinsem...@comcast.net wrote: On Mar 3, 2010, at 2:22 PM, jonas garcia wrote: Dear R users, I am trying to read a huge file in R. For some reason, only a part

Re: [R] End of line marker?

2010-03-04 Thread jonas garcia
character and replacing it with a blank (or whatever and then writing the file back out). You can then probably process it using read.table.; On Thu, Mar 4, 2010 at 12:50 PM, jonas garcia garcia.jona...@googlemail.com wrote: Thank you so much for your reply. I can identify

[R] End of line marker?

2010-03-03 Thread jonas garcia
Dear R users, I am trying to read a huge file in R. For some reason, only a part of the file is read. When I further investigated, I found that in one of my non-numeric columns, there is one odd character responsible for this, which I reproduce bellow:  In case you cannot see it, it looks like a

Re: [R] axis labels

2009-10-14 Thread jonas garcia
but with opposing orientation. Try fooling about with the mgp argument in axis(): par(mfrow=c(1,1), cex.axis = 0.5, cex.lab = 0.5) plot(1,1, axes = F) axis(1, mgp=c(3,0.7,0)) axis(2, mgp=c(3,1,0)) jonas garcia garcia.jona...@googlemail.com 10/13/09 5:58 PM Dear list, why does the distance

[R] axis labels

2009-10-13 Thread jonas garcia
Dear list, why does the distance between the axis labels and the tick marks looks different for x axis and y axis in the plot (see code below). In fact, the x axis labels look furthest from the tickmarks than in the y axis. How can I make them look the same? par(mfrow=c(1,1), cex.axis = 0.5,

Re: [R] help with functions

2009-09-05 Thread jonas garcia
, baptiste 2009/9/4 jonas garcia garcia.jona...@googlemail.com Hi all, I have got 2 function (see bellow) which are simplifications of what I need to do. These functions are precisely the same, except for the last line. My question is, why doesn't function testA work in the same

[R] help with functions

2009-09-04 Thread jonas garcia
Hi all, I have got 2 function (see bellow) which are simplifications of what I need to do. These functions are precisely the same, except for the last line. My question is, why doesn't function testA work in the same way as function testB. Both functions produce two objects, a and b that

Re: [R] cbind objects using character vectors

2009-09-02 Thread jonas garcia
Thanks Erik and Henrique, That's what I was after. Jonas On Tue, Sep 1, 2009 at 8:08 PM, Henrique Dallazuanna www...@gmail.comwrote: Try this: sapply(vec.names, get) But for this example, you don't need for, try: dat - 1 On Tue, Sep 1, 2009 at 2:52 PM, jonas garcia garcia.jona

[R] cbind objects using character vectors

2009-09-01 Thread jonas garcia
Dear list, I have a character vector such vec.names- c(a, b) It happens that I have also two R objects called a and b that I would like to merge. Is it possible to do something like cbind(vec.names[1], vec.names[2]) ending up with the same result as cbind(a,b) Bellow is a reproducible

[R] vector fragment

2009-05-16 Thread jonas garcia
Dear R users: I have got a simple question that has been bothering me for a while. Given a certain character vector, I would like to get in a separate vector a fragment of text, in this case the 3rd and 4th letters of each element. So, if: v- c(“stratosphere”, “mesosphere”,

Re: [R] missing argument

2008-12-11 Thread jonas garcia
-help@r-project.org Subject: Re: [R] missing argument ?missing never used it myself, but looks like it might help you :-) Tony Breyal. On 10 Dec, 19:09, jonas garcia garcia.jona...@googlemail.com wrote: Dear list, I have a question and I'm going to give an example of my problem f

[R] missing argument

2008-12-10 Thread jonas garcia
Dear list, I have a question and I'm going to give an example of my problem f- function(d1, d2, d3) { d- d1*d2/d3 return(d) } v1- 1 v2- 2 If I try f(v1, v2, v3) Error in f(v1, v2, v3) : object v3 not found I obviously got the above error message. I would like to add something to my function to

[R] extract bits of a character vector

2008-10-22 Thread jonas garcia
Dear list: I have the following problem: From a vector like this: vec- c(mud_1999_area_A, gravel_2004_area_F) I would like to get the year in a separate vector, such y- c(1999, 2004) I´ve been looking to grep() but I'm not sure how to do this. Help? Thanks in advance J

Re: [R] extract bits of a character vector

2008-10-22 Thread jonas garcia
Thank you all for the useful responses. Problem solved! J On Thu, Oct 23, 2008 at 12:14 AM, Duncan Murdoch [EMAIL PROTECTED]wrote: On 22/10/2008 5:02 PM, jonas garcia wrote: Dear list: I have the following problem: From a vector like this: vec- c(mud_1999_area_A, gravel_2004_area_F