Re: [R] Loop does not work: Error in else statement

2014-09-29 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Frank S. > Sent: Monday, September 29, 2014 9:17 PM > To: r-help@r-project.org > Subject: [R] Loop does not work: Error in else statement > > Hi to all members of R list, > >

Re: [R] how to get the rows that satisfy a specific condition

2014-09-29 Thread Fix Ace
Sorry for my confusing question. Thanks for all the inputs. I think Sven E. Templer gave the answer I needed... On Sunday, September 28, 2014 4:51 AM, Sven E. Templer wrote: in ?which read about arr.ind following jims assumption (column instead of row indices is what you want) t

Re: [R] Issue with a function

2014-09-29 Thread Jeff Newmiller
library(Matrix) result <- newX %*% Diagonal( unlist(beta) ) Is beta really a list, or is it a vector? The str function can help with this... in most cases it is a numeric mode vector and the unlist is not needed. --- Jeff New

Re: [R] "timeDate" package: Read dates from xls or txt

2014-09-29 Thread Jeff Newmiller
Your questions still don't make sense. Can you use a car to make lunch? You could use it to drive to the store and get ingredients for lunch, but it isn't a very useful question. The timeDate package is a package of useful functions, not a class of data. Re-read my description below, or better

Re: [R] Custom Function Not Completely working

2014-09-29 Thread Duncan Murdoch
On 29/09/2014, 9:07 PM, Lopez, Dan wrote: > Hi R Experts, > > I'm in the process of creating a set of convenience functions for myself. I > am somewhat new to writing functions in r. > > In this example I wanted to load both existing files called KuhnPerform.Rdata > and KuhnPerform.Rhistory. Ho

[R] Issue with a function

2014-09-29 Thread Yara Abu Awad
Hi, I'm trying to use a function to multiply a matrix (newX) with a simple list (beta). I know that I can simply use matrix multiplication i.e. newX %*%as.matrix(beta) and this works fine. However, the matrix multiplication gives me the sum of each row. What I really need are the new values of a

Re: [R] "timeDate" package: Read dates from xls or txt

2014-09-29 Thread jpm miao
Thanks. Could "timeDate" object be transformed to/from "zoo" or "xts"? 2014-09-30 9:01 GMT+08:00 Jeff Newmiller : > If you read the documentation for that package you will find that the > answer is no, for the simple reason that it doesn't do input or output. It > does help you with conversions b

[R] Custom Function Not Completely working

2014-09-29 Thread Lopez, Dan
Hi R Experts, I'm in the process of creating a set of convenience functions for myself. I am somewhat new to writing functions in r. In this example I wanted to load both existing files called KuhnPerform.Rdata and KuhnPerform.Rhistory. However it only works for loading the .Rhistory file and

Re: [R] "timeDate" package: Read dates from xls or txt

2014-09-29 Thread Jeff Newmiller
If you read the documentation for that package you will find that the answer is no, for the simple reason that it doesn't do input or output. It does help you with conversions between POSIXt types, and can help figure out which days are holidays or weekends, but you need the date in character fo

Re: [R] If statement not working in a for loop when making it independent

2014-09-29 Thread Jeff Newmiller
You have really tied yourself up in a knot here. Last I checked, when A==B, then B==A. You also need to study the difference between ?if and ?ifelse, since you are not giving the if function the scalar it expects. For example, i$ID is a vector of three (identical, due to your use of split) value

Re: [R] hadley's book

2014-09-29 Thread Grant Rettke
On Mon, Sep 29, 2014 at 10:59 AM, Mark Leeds wrote: > Just a heads up to list: I don't know about other book sites but, on U.S > Amazon, Hadley's Advanced R book is no longer in pre-order mode. You can > purchase the book now without pre-ordering it. Thank you for the notice. Just bought it for

[R] If statement not working in a for loop when making it independent

2014-09-29 Thread Nebulo Archae
Dear all, I have a data.frame xy that contains numeric data and data_qual which contains qualitative data which I want to include in a for loop with an if statement (commented out in the code below). The if statement should be applied if the ID in data_qual$ID is the same than in xy$ID. I am t

[R] fitting distribution

2014-09-29 Thread eliza botto
Dear UseRs, I have a dataset in the following form. > dput(Da) structure(c(0.0238095238095238, 0.0476190476190476, 0.0714285714285714, 0.0952380952380952, 0.119047619047619, 0.142857142857143, 0.167, 0.19047619047619, 0.214285714285714, 0.238095238095238, 0.261904761904762, 0.285714

Re: [R] could not plot my spatial species points on the raster data

2014-09-29 Thread MacQueen, Don
Possibly, not much help is possible without the data, or a reproducible example. This is probably better asked on r-sig-geo A few more comments, inserted below -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 9/27/14, 1:36 AM

Re: [R] residuals of glm

2014-09-29 Thread Ben Bolker
Yuan Jian yahoo.com> writes: > > Hello, > I found the residuals of glm is not the same as calculated manually. > >y=c(12,14,33,50,67,74,123,141,165,204,253,246,240) > > t=1:13 > > m1=glm(y~t+I(t^2),family=poisson(link="log")) > > coefficients(m1)[1]+coefficients(m1)[2]*log(t)+ > coefficients(m1

Re: [R] Loop does not work: Error in else statement

2014-09-29 Thread Berend Hasselman
Please, please do not post in HTML as the Posting guide requests. See the tail of each message to R-help. Your code is completely messed up and unreadable. Berend On 29-09-2014, at 21:17, Frank S. wrote: > Hi to all members of R list, > > > > I�m working with data.table package, and with 6

[R] Chen.Deo test

2014-09-29 Thread Simon Ouellette
I made artificial random walk signals in a spreadsheet, and ran them through the Chen.Deo (vrtest package) test in R. When the "k vector" contains only, say, 2-3 values, I get the correct VR sum = approximately 1. However, when I add one or two more k values, suddenly the VR sum goes up to around

[R] Loop does not work: Error in else statement

2014-09-29 Thread Frank S.
Hi to all members of R list, I�m working with data.table package, and with 6 variables: "ID" (Identifier), "born" (Birthdate), "start" (Starting date), "register" (date of measurement), "value"and "end" (date of expiration). So, the natural order of dates would be: born =< start =< register =

[R] Package 'compositions', function acomp() With Missing Data

2014-09-29 Thread Rich Shepard
The acomp() function works well on data sets with no missing data. For example: win.acomp <- acomp(win.cast, parts=2:6) win.acomp Filterer Gatherer Grazer Predator Shredder [1,] 0.0667 0.600 0.0667 0.2444000 0.0222 [2,] 0.06120612 0.5714571 0.06120612 0.2653265 0

[R] Univariate results from MANOVA with Adonis?

2014-09-29 Thread Martina Ozan
Hi, I am using function Adonis in Vegan to do MANOVA. My response variable is a chemical profile of an insect composed of different chemical compounds (=my data columns). My predictors include factors as well as continuous variables. My question is: Is it possible to get out from adonis,

Re: [R] hadley's book

2014-09-29 Thread Mohan Radhakrishnan
Does this shed some light on advanced R that ML tools h2o use ? MapR could also be using distributed R. Thanks, Mohan On Mon, Sep 29, 2014 at 9:43 PM, John McKown wrote: > Thanks for the heads up. I just ordered it. Curiously, I can't read it > using the "Cloud Reader" in my browser, so I'll wa

Re: [R] hadley's book

2014-09-29 Thread John McKown
Thanks for the heads up. I just ordered it. Curiously, I can't read it using the "Cloud Reader" in my browser, so I'll wait until I get home to look at it on my Nexus 10. On Mon, Sep 29, 2014 at 10:59 AM, Mark Leeds wrote: > Just a heads up to list: I don't know about other book sites but, on U.

[R] hadley's book

2014-09-29 Thread Mark Leeds
Just a heads up to list: I don't know about other book sites but, on U.S Amazon, Hadley's Advanced R book is no longer in pre-order mode. You can purchase the book now without pre-ordering it. Mark [[alternative HTML vers

Re: [R] error in rownames

2014-09-29 Thread Adams, Jean
Chris, I think your best bet is to find someone locally that is familiar with R, and show them this correspondence. They will be able to help you post your question so that you have the best chance of getting an answer. Or, perhaps, they will be able to answer the question themselves. Jean On

Re: [R] Could someone recommend a package for time series?

2014-09-29 Thread Gabor Grothendieck
On Mon, Sep 29, 2014 at 5:05 AM, jpm miao wrote: > Hi, > >I've not used R for about one year and don't know well about the updates > on the time series-related package. > > My primary job is to do economic/financial time series data analysis - > annual, monthly, daily, etc. I usually read da

Re: [R] if else statement in loop

2014-09-29 Thread PIKAL Petr
Hi Still cloudy, still errors. > for(i in length(1:(nrow(X{ + Y$IID1new <- ifelse((as.character(Y[,2]) == as.character(X[,i]) & + Y$IID1new != ''), as.character(as.matrix(X[,(nrow(X)+i)])),'') + } Error in `$<-.data.frame`(`*tmp*`, "IID1new", value = logical(0)) : replacement has 0 rows

Re: [R] Plotting Categorical/Numerical Data?

2014-09-29 Thread Jason Eyerly
1. Okay? 2. It was also said to be unlikely that the Wright brothers would take flight, or that the earth orbited the moon. 3. One step ahead. -Jason On Sep 28, 2014 6:53 PM, "Bert Gunter" wrote: > 1. Homework? We don't do homework here. > > 2. I believe what you purport to do is unlikely answ

Re: [R] Could someone recommend a package for time series?

2014-09-29 Thread Bannert Matthias
Hi, the Cran Task View about time series that pascal just send is certainly helpful. Personally I think the standard ts() already can do a lot for you. Apart from that I like zoo particularly if you have other than yearly frequencies like quarterly or even irregular frequencies to handle. T

[R] residuals of glm

2014-09-29 Thread Yuan Jian
Hello, I found the residuals of glm is not the same as calculated manually. >y=c(12,14,33,50,67,74,123,141,165,204,253,246,240) > t=1:13 > m1=glm(y~t+I(t^2),family=poisson(link="log")) > coefficients(m1)[1]+coefficients(m1)[2]*log(t)+coefficients(m1)[3]*log(t^2) [1] 1.901459 2.257258 2.465388 2.6

Re: [R] How to get rid of my for loop

2014-09-29 Thread ONKELINX, Thierry
Dear Barry, You have to rethink the input format. This is easy if you use a matrix. A <- cbind(A_01, A_02, A_03, A_04) index <- cbind(seq_along(VFD_ID), VFD_ID) A[index] Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Bi

Re: [R] if else statement in loop

2014-09-29 Thread Kate Ignatius
Ooops, I edited the code wrong to make it more easier for interpretation and got X and Y's mixed up. Try this: for(i in length(1:(nrow(X{ Y$IID1new <- ifelse((as.character(Y[,2]) == as.character(X[,i]) & Y$IID1new != ''), as.character(as.matrix(X[,(nrow(X)+i)])),'') } The second should

[R] How to get rid of my for loop

2014-09-29 Thread Barry King
# Here are sample data, sample vectors, and a for loop # that I am using now. I wish to get rid of the for loop # and use functions and one of the apply functions to # perform the work without needing a many iteration for loop. A_01 <- 1:5 A_02 <- 6:10 A_03 <- 11:15 A_04 <- 16:20 B_01 <- 101:105 B

Re: [R] Could someone recommend a package for time series?

2014-09-29 Thread jpm miao
Thanks Pascal! It certainly helps! 2014-09-29 17:10 GMT+08:00 Pascal Oettli : > Hi Miao, > > You certainly will find useful answers here : > http://cran.r-project.org/web/views/TimeSeries.html > > Regards, > Pascal Oettli > > On Mon, Sep 29, 2014 at 6:05 PM, jpm miao wrote: > > Hi, > > > >I'

[R] "timeDate" package: Read dates from xls or txt

2014-09-29 Thread jpm miao
Hi, timeDate package create a date vector like this: Dates <- c("1989-09-28","2001-01-15","2004-08-30","1990-02-09") I have a date whose size is large. Could this package read the dates from xls or txt files? Could we convert the read vector (e.g., I usually use XLConnect to read xls f

Re: [R] Savitzky-Golay Smoother

2014-09-29 Thread Erick Okuto
Dear Gabor, Paul and Ryan, Many thanks for all your guidance concerning the application of the filter/smoother. I need to temporally smooth 32 years 5 km resolution bi-monthly global NDVI dataset. On average each pixel have got up to 768 cases/images with data missing at random. I consider the dat

Re: [R] draw piecharts or histograms at the points of a scatterplot

2014-09-29 Thread Duncan Murdoch
On 28/09/2014, 6:10 PM, rh...@numberland.de wrote: > Hi, > > I?m fairly new to R and have a problem mentioned in the subject ... > > I want to draw a scatterplot in 3d - either with scatterplot3d or - > preferably - with the rgl package - but instead of points or text > (text3d command of rgl)

Re: [R] Could someone recommend a package for time series?

2014-09-29 Thread Pascal Oettli
Hi Miao, You certainly will find useful answers here : http://cran.r-project.org/web/views/TimeSeries.html Regards, Pascal Oettli On Mon, Sep 29, 2014 at 6:05 PM, jpm miao wrote: > Hi, > >I've not used R for about one year and don't know well about the updates > on the time series-related p

[R] Could someone recommend a package for time series?

2014-09-29 Thread jpm miao
Hi, I've not used R for about one year and don't know well about the updates on the time series-related package. My primary job is to do economic/financial time series data analysis - annual, monthly, daily, etc. I usually read data by the package "XLConnect", which can read xls or xlsx file

Re: [R] Unexpected behaviour of plyr::ddply

2014-09-29 Thread Patrick Connolly
On Wed, 17-Sep-2014 at 12:36AM -0300, walmes . wrote: |> Hello R users, |> |> I'm writing a brief tutorial of getting statistical measures by splitting |> according strata and over columns. When I used plyr::ddply I got and |> unexpected result, with NA/NaN for non existing cells. Below is a mini