Re: [R] Help with script

2017-12-29 Thread Ek Esawi
Hi Pablo, Rui's suggestion is probably the best and easiest. In addition to Eric's, i think the apply functions will work well here too. Best of luck, EK On Thu, Dec 28, 2017 at 7:03 PM, PABLO ORTIZ PINEDA wrote: > Hello there. Happy new year for everyone! > > I need help with a table. This ta

Re: [R] Help with script

2017-12-28 Thread Rui Barradas
Hello, Just use ?aggregate. Example <- read.table(text = " ID ABCDEFG a1 0001120 a2 0101221 a2 0112021 a3 0111111 ", header = TRUE) aggregate(. ~ ID, Example , sum)

Re: [R] Help with script

2017-12-28 Thread Eric Berger
Hi Pablo, There are probably many ways to do this in R. This suggestion uses dplyr. The solution is actually only one line (see the line starting with dat2). The first section simply creates the example data. library(dplyr) # 1. set up the example data m <- matrix( c(0,0,0,0,0,1,1,1,0,0,1,1,1,1,2,

[R] Help with script

2017-12-28 Thread PABLO ORTIZ PINEDA
Hello there. Happy new year for everyone! I need help with a table. This table contains 300 rows and 192 columns. Being the first column the ID of my samples that can have several observations. I need to generate e NEW table that contains a single ID with the sum of the observations by columns

Re: [R] help with script to get starting date of blooms

2014-07-19 Thread Veronica Andreo
Hi Jim 2014-07-19 8:25 GMT-03:00 Jim Lemon : > > Hi Vero, > I think this does what you want, even though it doesn't do it the way > you describe above. > > cla<-runif(506)+ > rep(c(seq(1,3,length.out=23),seq(3,1,length.out=23)),11) > obs_time<-paste(rep(1:11,each=46),rep(1:46,11),sep="_") > t_ma

Re: [R] help with script to get starting date of blooms

2014-07-19 Thread Jim Lemon
On Fri, 18 Jul 2014 10:15:35 AM Veronica Andreo wrote: > Hi list > > I have a vector, which are remotely sensed chlorophyll values for a certain > pixel in 11 years, then i have a flag or label vector (t_max) that consists > of 0 and 1, which tells me where i have the annual peak (one per year,

[R] help with script to get starting date of blooms

2014-07-18 Thread Veronica Andreo
Hi list I have a vector, which are remotely sensed chlorophyll values for a certain pixel in 11 years, then i have a flag or label vector (t_max) that consists of 0 and 1, which tells me where i have the annual peak (one per year, then eleven 1 and all the rest are 0). I'm interested in extractin