Re: [R] need for help for solving operations in a vector

2015-12-30 Thread Bert Gunter
"Maybe you shall spend some time reading R intro manual which can serve you as an excellent starting point to learn R. Although it has one hundred pages it is quite readable and you may find it as a best present you found under Christmas tree." Fortune nomination! Cheers, Bert Bert Gunter

Re: [R] need for help for solving operations in a vector

2015-12-29 Thread Makram Belhaj Fraj
Hi Petr I do thé calculation left as follows Irrig=qWC1 Irrig [Irrig>HM]=-1 Irrig[Irrig>0]=0 Irrig.tot=-Irrig*6.123 #6.123 is the hydraulic conductivity at saturation And I got the vector needed Cheers Makram Le 28 déc. 2015 12:15, "PIKAL Petr" a écrit : > Hi > > On top

Re: [R] need for help for solving operations in a vector

2015-12-29 Thread Makram Belhaj Fraj
Hi Petr I am adjusting my email and sorry for thé inconvenience I read about these commands. The method is good for my case with threshold of .02. I need just to have a vector with the values of the réd points in réd equal to 1-do you have an idea how to do it?- so I could calculate total

Re: [R] need for help for solving operations in a vector

2015-12-29 Thread PIKAL Petr
Hi You probably can do also only Irig.tot <- (Irrig>HM)*6.123 to get desired vector without any further typing around. Logical vector can be treated as c(0,1) vector. FALSE equals zero and TRUE equals 1 on calculations. Maybe you shall spend some time reading R intro manual which can serve

Re: [R] need for help for solving operations in a vector

2015-12-29 Thread Makram Belhaj Fraj
Hi Petr I runned the code you gave me as following, and I am adjusting for the threshold as suggested, sss<-smooth.spline(qWC1, tint, nknots=length(tint)/2) peak <- which.max(predict(sss)$y) #qWC1=temp$theta mtime=temp$int baseline <- min(predict(sss)$y) vyska <- predict(sss)$y[peak] # 50%

Re: [R] need for help for solving operations in a vector

2015-12-29 Thread Makram Belhaj Fraj
Hi Petr, I apologize It was my first time using r-help so I didn't know how to replay to email to all or not, I am replaying to all for this email, Many thanks for the code, I am trying to use it, please find attached the data file in csv, following are the first lines of code to read the data

Re: [R] need for help for solving operations in a vector

2015-12-29 Thread PIKAL Petr
Hi First you shall adjust your mail client to send post in plain text not HTML, as suggested by Posting guide. It shall be available in gmail too. Second you do not run my code:-( You run **your** code which is (slightly) **similar** to the code I sent you however it is completely wrong. If

Re: [R] need for help for solving operations in a vector

2015-12-28 Thread PIKAL Petr
Hi On top of answers you have got here is some plotting you need to answer yourself plot(qWC1, col=(c(0, diff(qWC1))>=0 )+1) Which from those red points you want to be included in irrigation period? All of them? Only part? Which part? Based on your figures you probably will not get 100%

Re: [R] need for help for solving operations in a vector

2015-12-28 Thread PIKAL Petr
Hi You shall send your posts to the list, others can answer your questions and not only you can benefit from their answers too. As you did not post any data it is hard to say what are your issues. I believe that there are several values which are the same not only near the peak but also at

Re: [R] need for help for solving operations in a vector

2015-12-25 Thread Giorgio Garziano
I think that the rle() function may help you to tackle the problem in a more general way. https://stat.ethz.ch/R-manual/R-devel/library/base/html/rle.html Using William's suggested series: x <- c(2,2,3,4,4,4,4,5,5,5,3,1,1,0,0,0,1,1,1) > x [1] 2 2 3 4 4 4 4 5 5 5 3 1 1 0 0 0 1 1 1 rle.x <-

[R] need for help for solving operations in a vector

2015-12-23 Thread Makram Belhaj Fraj
Dear colleagues i need your generous help to solve the following problem I have a soil moisture time series qWC1 (61 values) > qWC1 75.6 75.20617 75.20617 74.95275 74.95275 74.70059 74.70059 74.70059 74.57498 74.44968 74.32469 74.07563 85.57237 90.40123 90.73760 90.73760 90.73760 90.73760

Re: [R] need for help for solving operations in a vector

2015-12-23 Thread David L Carlson
I don't think you know what your code is doing. First, do not use html emails, only plain text. Secondly, provide the data in a portable way with the dput() function: > dput(qWC1) c(75.6, 75.20617, 75.20617, 74.95275, 74.95275, 74.70059, 74.70059, 74.70059, 74.57498, 74.44968, 74.32469,

Re: [R] need for help for solving operations in a vector

2015-12-23 Thread William Dunlap via R-help
What answer do you want for the following data? x <- c(2,2,3,4,4,4,4,5,5,5,3,1,1,0,0,0,1,1,1) Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Dec 22, 2015 at 11:34 PM, Makram Belhaj Fraj < belhajfraj.mak...@gmail.com> wrote: > Dear colleagues > i need your generous help to solve the