[R] R truncating decimal places

2017-05-22 Thread Andrea Goijman
Hello list, I' trying to estimate a log likelihood function from my data. I apply the mean to all my simulations, and I get something like this: apply(likelihood, c(2, 3, 4), mean,na.rm=TRUE) , , 1 [,1] [,2] [,3] [,4] [,5][,6] [,7] [1,] 0.73162327

[R] Aggregate rows with same fields, within factors

2013-09-16 Thread Andrea Goijman
Dear R list, I want to aggregate the number of individuals 'IND' of the same ORDER, within each site and season CAMP,TRANS... but I also want to keep record of the habitat HAB and LOTE For example I have this: CAMP LOTE HAB TRANS IND ORDEN 1765 C1 B1 BB1 7 HEMIPTERA

Re: [R] Aggregate rows with same fields, within factors

2013-09-16 Thread Andrea Goijman
ORTHOPTERA 2 18 C1 B1 BB3 ORTHOPTERA 1 A.K. - Original Message - From: Andrea Goijman agoij...@cnia.inta.gov.ar To: R help r-help@r-project.org Cc: Sent: Monday, September 16, 2013 11:09 AM Subject: [R] Aggregate rows with same fields, within factors Dear R list

[R] Problems using lmer {lme4}

2013-05-17 Thread Andrea Goijman
Dear R list, I'm attaching a sample of my data which consists on the presence/absence (punto6, binomial n=5 occasions) of different species (sp), on different sites (site) within routes ('route). First, I want to be able to find if there is autocorrelation of the response variable between the

Re: [R] Problems using lmer {lme4}

2013-05-17 Thread Andrea Goijman
, by including a small number of mock observations with only the relevant variables, in a table instead of in R syntax), that would be helpful. Patrick 2013/5/17 Andrea Goijman agoij...@cnia.inta.gov.ar: Dear R list, I'm attaching a sample of my data which consists on the presence/absence

[R] Changing frequency values to 1 and 0

2013-01-16 Thread Andrea Goijman
Dear list, I'm working with a large data set, where I grouped several species in one group (guild). Then I reshaped my data as shown below. Now, I just want to have Rep only as 1 or 0. I'm not being able to change the values of rep=1 to 1... tried many things and I'm not being successful!

Re: [R] Changing frequency values to 1 and 0

2013-01-16 Thread Andrea Goijman
Sure! Although I'm not sure how to use dput() Here is more detail and some data what I want is that the repetitions in Y (at the end) only have 1 or 0... library(reshape) library(car) ###Read in the occurence data occ.data - read.table(Occ_short.csv, header=TRUE,sep=,,na.strings=TRUE)

Re: [R] Changing frequency values to 1 and 0

2013-01-16 Thread Andrea Goijman
4 5 # 1086 1 1 1 0 1 # 1112 1 1 0 0 1 # 1115 1 0 1 1 1 # 1116 1 1 0 1 0 # 2051 0 0 0 0 0 A.K. - Original Message - From: Andrea Goijman agoij...@cnia.inta.gov.ar To: R help r-help@r-project.org Cc: Sent: Wednesday, January 16, 2013 10:42 AM Subject: [R] Changing

Re: [R] help reshaping dataframe

2013-01-05 Thread Andrea Goijman
) flat.occ-dcast(occ.data1,Año+Site+Especie+Pres~Rep,value.var=Rep) flat.occ[,-c(1:4)]-sapply(flat.occ[,-c(1:4)],function(x) as.integer(is.na (x))) flat.occ[1:10,] On Sat, Jan 5, 2013 at 12:26 AM, Jim Lemon j...@bitwrit.com.au wrote: On 01/05/2013 10:15 AM, Andrea Goijman wrote: ... Hi Andrea

[R] help reshaping dataframe

2013-01-04 Thread Andrea Goijman
List, I want to reshape my data, but I'm not sure how to do it... it might be a simple task, but don't know which package does this. occ.data (see below) is how my original data are arranged, and I know that with melt() I can reshape it like y (see below). However, I just want to build a matrix

[R] Listing elements of a 4D array

2012-11-21 Thread Andrea Goijman
Dear list, I'm having trouble to see how my elements on a 4 dimensional array are listed. For example, I generated the following array: junk.melt=melt(occ.data,id.var=c(Especie, Site, Rep, Año), measure.var=Pres) y=cast(junk.melt, Site ~ Rep ~ Especie ~ Año) Now, I want to be able to look at

[R] Fwd: Simulate nested data

2012-11-09 Thread Andrea Goijman
I know this seems like a very easy question (and maye it is) but I've been trying to simulate nested data and been unsucessful so far.. I want to simulate a varying number of species within a group; and then create an array to store the results of my for-loop. For example: groups-3

Re: [R] Fwd: Simulate nested data

2012-11-09 Thread Andrea Goijman
On Fri, Nov 9, 2012 at 2:16 PM, Andrea Goijman agoij...@cnia.inta.gov.ar wrote: I know this seems like a very easy question (and maye it is) but I've been trying to simulate nested data and been unsucessful so far.. I want to simulate a varying number of species within a group

Re: [R] Fwd: Simulate nested data

2012-11-09 Thread Andrea Goijman
the R object species. Thus, I changed the name of that R object to speciesgroups and altered your code so that it runs by removing the erroneous c(). Did you try my suggestion, and did or did it not help your problem? Sarah On Fri, Nov 9, 2012 at 2:37 PM, Andrea Goijman agoij

Re: [R] Fwd: Simulate nested data

2012-11-09 Thread Andrea Goijman
by species(group1), since there is no species() # function defined On Fri, Nov 9, 2012 at 2:49 PM, Andrea Goijman agoij...@cnia.inta.gov.ar wrote: Yes, I tried your suggestion, but it didn't help. It just creates a tri-dimentional array for p... and that is not what I want p per species

Re: [R] Presence/ absence data from matrix to single column

2012-10-08 Thread Andrea Goijman
. From: Andrea Goijman agoij...@cnia.inta.gov.ar To: arun smartpink...@yahoo.com Cc: Rui Barradas ruipbarra...@sapo.pt; R help r-help@r-project.org Sent: Sunday, October 7, 2012 7:16 PM Subject: Re: [R] Presence/ absence data from matrix to single column Ill try this one as well. And I guess

Re: [R] Presence/ absence data from matrix to single column

2012-10-07 Thread Andrea Goijman
Ill try this one as well. And I guess the one below is not going to work, because all my species have different names. Thanks! #nms - names(adat) nms - c(Year, Route, Point, paste0(Sp, 1:250)) pattern - ^Sp[[:digit:]]+$ whichCols - grep(pattern, nms) whichNames - nms[whichCols] reshape(...,

[R] Presence/ absence data from matrix to single column

2012-10-06 Thread Andrea Goijman
I've been trying to reshape this database but haven't succeed at it. I tried using loops but can't get it right. I just want to reshape my database from this matrix, to the one below, with only one column of data. Year Route Point Sp1 Sp2 Sp3 2004 123 123-1 0 1 0 2004 123 123-2 0 1 1 2004 123