[R] Returning combine output from R loop

2013-05-30 Thread Abdul Rahman bin Kassim (Dr.)
Dear R-User, Appreciate any advice on producing combine output from an R loop. Planning to project the growth (grow) of plant species (sp) from its initia size (initial_size). Using the follwing example, how can I produce the results combining the output from 3 iteration. The ouput a2 produce

Re: [R] Subset a floating point vector using all.equal?

2013-05-30 Thread Peter Lomas
Hi, Thanks for the help. Both of the responses work the way I need it to. Cheers, Peter On Thu, May 30, 2013 at 4:34 AM, Rui Barradas wrote: > Hello, > > You can write a helper function. > > are.equal <- function(x, y, eps = .Machine$double.eps^0.5) abs(x - y) < eps > > x[are.equal(x, 0.15)]

Re: [R] How can I write logical function in R?

2013-05-30 Thread Peter Lomas
Not sure whether your data is just 0's and 1's, but something like this may also work for you: imm <- 1*(speciesTime2[ , 2:4] == 1 & speciesTime2[ , 2:4] != speciesTime1[ , 2:4]) imm <- cbind(imm, sum = rowSums(imm)) Exti <- 1*(speciesTime2[ , 2:4] == 0 & speciesTime2[ , 2:4] != speciesTime1[ , 2

[R] 3.0.1 update and compiler package

2013-05-30 Thread Christoph Knapp
Hi, I recently updated to R 3.0.1. I'm running linux ubuntu 12.04. I realized that I have to update all the installed packages so I run > update.packages(checkBuilt=TRUE) as described here http://www.r-bloggers.com/r-3-0-0-is-released-whats-new-and-how-to-upgrade/ . The first thing it did was

Re: [R] help on multivariate time series in R

2013-05-30 Thread Aakanksha Dahiya01
I have read that MARSS,VAR,VARIMA are some of the functions that help in multivariate time series analysis but nothing is explained further on internet.. kindly help From: Greg Snow [mailto:538...@gmail.com] Sent: Friday, May 31, 2013 12:27 AM To: Aakanksha Dahiya01 Cc: Blaser Nello; r-help@r-pr

Re: [R] merge_recurse in libray reshape - how does it work?

2013-05-30 Thread Bert Gunter
Have you studied the Help file for Recall() . (It is not clear to me that you have). Do you understand what recursion is? ( this is a simple example of it). Try constructing a very simple example and then work through what the code does in it step by step. I'll leave it to others to attempt a min

Re: [R] wilcox_test function in coin package

2013-05-30 Thread Janh Anni
Hello Greg, Thank you so much for your kind assistance. It looks like there's no way around using the formula format. I longed in vain for a simpler script more like the wilcox.test format. Thanks again. Janh On Thu, May 30, 2013 at 6:21 PM, Greg Snow <538...@gmail.com> wrote: > Ok, it look

[R] merge_recurse in libray reshape - how does it work?

2013-05-30 Thread Stephen Sefick
merge_recurse function (dfs, ...) { if (length(dfs) == 2) { merge(dfs[[1]], dfs[[2]], all = TRUE, sort = FALSE, ...) } else { merge(dfs[[1]], Recall(dfs[-1]), all = TRUE, sort = FALSE, ...) } } I do not understand how the Recall part of this function wo

Re: [R] Pkg to "do counting process in survival analysis"… was : a question

2013-05-30 Thread David Winsemius
On May 30, 2013, at 5:48 PM, David Winsemius wrote: > > On May 30, 2013, at 10:40 AM, Patty Haaem wrote: > >> HiI have a question, Is there a package to do counting process in survival >> analysis with R? > > The 'survival' package has been the standard resource for over a decade and > is no

Re: [R] write table in ascii

2013-05-30 Thread Jeff Newmiller
I would bet the problem is end-of-line convention. This is a very old problem of text file conversion that has many solutions, none of which should be addressed by R. Rather, you should use any of the many standard file transfer mechanisms that understand EOL issues in text files, rather than tr

[R] Pkg to "do counting process in survival analysis"… was : a question

2013-05-30 Thread David Winsemius
On May 30, 2013, at 10:40 AM, Patty Haaem wrote: > HiI have a question, Is there a package to do counting process in survival > analysis with R? The 'survival' package has been the standard resource for over a decade and is now a "Suggested" package. I suggest you buy Therneau and Gramsch: "Mo

Re: [R] lmer (multinomial response variable ~ fixed + (1|random), family='"multinomial" ???)

2013-05-30 Thread Ben Bolker
Maggie Wisniewska gmail.com> writes: > > Hello, > I am trying to run glmm to test the effect of the three fixed effects [AGE > (weaned vs. unweaned claf), LOCATION (zoo vs. park), MOTher's social status > (matriarch vs. nonmatriarch)] and one random effect [ID (12 different > calves of whom I h

Re: [R] write table in ascii

2013-05-30 Thread Sarah Goslee
Ah. On Thu, May 30, 2013 at 6:56 PM, Gary Dong wrote: > I am working in Windows system. But a software I am using requires data > input in ascii (.dat, delimiters can be tabs or spaces). I was able to save > the data into .dat (ascii) from SPSS, but it keeps causing problems. Thank > you! Don't

Re: [R] write table in ascii

2013-05-30 Thread Gary Dong
I am working in Windows system. But a software I am using requires data input in ascii (.dat, delimiters can be tabs or spaces). I was able to save the data into .dat (ascii) from SPSS, but it keeps causing problems. Thank you! Gary On Thu, May 30, 2013 at 3:51 PM, Sarah Goslee wrote: > On Thu,

Re: [R] write table in ascii

2013-05-30 Thread Sarah Goslee
On Thu, May 30, 2013 at 6:35 PM, Gary Dong wrote: > Dear R users, > > I have a data set in .csv and I hope to convert it to .dat (ascii) so it > can work in an UNIX environment. Anyone can help me? Thank you! Please expand. Why can't you work with csv in a UNIX environment? I do it all the time.

Re: [R] How can I write logical function in R?

2013-05-30 Thread arun
Hi, May be this helps: speciesTime1New<- speciesTime1[,-1] speciesTime2New<- speciesTime2[,-1] imm1<-as.data.frame(matrix(0,4,3))  imm1[]<-lapply(seq_len(ncol(speciesTime2New)),function(i) ifelse(speciesTime2New[,i]==1& speciesTime2New[,i]!=speciesTime1New[,i],1,0)) Ext1<-as.data.frame(matrix(0,4,

[R] write table in ascii

2013-05-30 Thread Gary Dong
Dear R users, I have a data set in .csv and I hope to convert it to .dat (ascii) so it can work in an UNIX environment. Anyone can help me? Thank you! Gary [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.

Re: [R] T statistic exactRankTests package

2013-05-30 Thread Peter Ehlers
On 2013-05-30 04:20, Al Zou wrote: I understand this might be a silly question, but I have problems understanding the statistic term returned in most permutation packages. for example: x<-c(8,4,6) y<-c(5,3,4) res<-exactRankTests::perm.test(x,y,paired=TRUE) 1-sample Permutation Test d

Re: [R] wilcox_test function in coin package

2013-05-30 Thread Greg Snow
Ok, it looks like the function mainly works through the formula syntax. It still would have been nice to have a reproducible example of what your data may look like, but I can show an example with simulated x and y: > x <- rpois(10, 3) > y <- rpois(11, 3.1) > mydf <- data.frame( vals = c(x,y), +

Re: [R] wilcox_test function in coin package

2013-05-30 Thread Janh Anni
I thought (hoped) wilcox_test(x,y) would do it but it doesn't and the package maintainer says the data have to be rearranged but does not specify how. Thanks Janh On Thu, May 30, 2013 at 6:05 PM, Greg Snow <538...@gmail.com> wrote: > What have you tried so far? Have you read the help page? h

Re: [R] How can I write logical function in R?

2013-05-30 Thread Sarah Goslee
Or here's a simpler solution than you've been presented: # this is easier without the site column sp1 <- speciesTime1[,-1] sp2 <- speciesTime2[,-1] # will work for abundance as well as presence, as long as # the minimum abundance is not less than 1 imm <- matrix(0, nrow=nrow(sp1), ncol=ncol(sp1))

Re: [R] wilcox_test function in coin package

2013-05-30 Thread Greg Snow
What have you tried so far? Have you read the help page? have you run the examples on that page? I would expect that it is something as simple as library(coin) wilcox_test(x,y) or wilcox_test( y ~ group ) But you should trust the help page more than the expectations of someone who has not rea

Re: [R] How can I write logical function in R?

2013-05-30 Thread Bert Gunter
I didn't follow your question in detail, but it sounds like the place to start is ?match and friends: ?intersect, ?setdiff, ?"%in%" ... Cheers, Bert On Thu, May 30, 2013 at 2:28 PM, Kristi Glover wrote: > Hi R -Users > I am sorry for bothering you. I was wondering what script can work to > calc

Re: [R] How can I write logical function in R?

2013-05-30 Thread Rui Barradas
Hello, Try the following. Maybe there are simpler ways, but it seems to work. fun <- function(df1, df2){ pres.abs <- function(x, y){ x <- as.logical(x) y <- as.logical(y) 1*(x & !y) } res <- matrix(nrow = nrow(df1), ncol =

[R] How can I write logical function in R?

2013-05-30 Thread Kristi Glover
Hi R -Users I am sorry for bothering you. I was wondering what script can work to calculate an immigration and extinction from two tables (time 1 and time 2). I could easily calculate them in the Excel for small data set, but I have very big data set. so that I was wondering to use R for this c

Re: [R] measuring distances between colours?

2013-05-30 Thread John Fox
Dear all, My thanks to everyone who addressed my question. I've incorporated Eik Vettorazzi's suggestion for improved conversion of hexadecimal RGB colours to decimal numbers, and Martin Maechler's hint to look at demo(colors). I've loosened the default definition of "close enough" from the latter

[R] wilcox_test function in coin package

2013-05-30 Thread Janh Anni
Dear All, I have two simple data samples (no groups or factors, etc.) and would just like to compute the two-sample Wilcoxon Rank Sum test using the wilcox_test function contained in the coin package, which is reportedly better than the regular wilcox.test function because it performs some adjustm

Re: [R] help on multivariate time series in R

2013-05-30 Thread Greg Snow
Aakanksha, Install the fortures package for R then run the following: library(fortunes) fortune(122) Hopefully that will lead to enlightenment that will help you help us to help you. On Thu, May 30, 2013 at 12:29 AM, Aakanksha Dahiya01 < aakanksha_dahiy...@infosys.com> wrote: > An example wo

Re: [R] Fwd: Obtaing the maximum

2013-05-30 Thread arun
Thanks Bill for the email. Your function looks great. f2<- function(x) x[c(diff(x)<1,TRUE)]  f2(a4) #[1]  8  4  4  4 13 12  f2(a3) #[1]  8  1  1  1 13  4 Using the example you provided. set.seed(24)   a5 <- sample(20, replace=TRUE, size=1e7)  f1New<- function(x) x[c(diff(x)<0,TRUE)|c(x[-length

Re: [R] Fwd: Obtaing the maximum

2013-05-30 Thread William Dunlap
> or ... a shorter way would be: > > a1<-c(1,2,3,4,5,1,2,3,1,1,1,2,3,4,5,1,2,3) > > a1[c(which(diff(a1)!=1),length(a1))] Or, even shorter, a1[c(diff(a1) != 1, TRUE)] Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [ma

Re: [R] Obtaing the maximum

2013-05-30 Thread arun
In cases like: a3<-c(c(1,4,5,8),rep(1,3),c(1,8,11,13),1:4)  a3[c(which(diff(a3)!=1),length(a3))] # [1]  1  5  8  1  1  1  1  8 11 13  4  a3[sort(c(which(c(diff(a3)<0,TRUE)), which(a3[-length(a3)] == a3[-1])))] #[1]  8  1  1  1 13  4 #or a4<-c(c(1,4,5,8),rep(4,3),c(1,8,11,13),8:12)  a4[c(which(di

[R] a question

2013-05-30 Thread Patty Haaem
HiI have a question, Is there a package to do counting process in survival analysis with R? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide h

Re: [R] [BioC] comparing two tables

2013-05-30 Thread tomkina
UPD: there should be 2 instead of 4 in the resulted table and chr2 line should be included. The problem has been solved with plyr library. Thanks -- View this message in context: http://r.789695.n4.nabble.com/comparing-two-tables-tp3936306p4668298.html Sent from the R help mailing list archi

Re: [R] [BioC] comparing two tables

2013-05-30 Thread arun
Hi Tamara, No problem.  dat3<- rbind(dat1,dat2)  #Sorry, forgot this line. A.K. From: Tamara Simakova To: arun Sent: Thursday, May 30, 2013 12:26 PM Subject: Re: [R] [BioC] comparing two tables Hello Arun, Thanks very much for help. Indeed there is a

Re: [R] [BioC] comparing two tables

2013-05-30 Thread arun
Assuming that you wanted to label '1' for table1 and '4' for table2 (info column).  Also, not sure why chr2 row is not in the resulted table. dat1<- read.table(text=" chr    pos    ref    alt chr1    5    A    G chr1    8    T    C chr2    2    C    T ",sep="",header=TRUE,stringsAsFactors=FAL

Re: [R] Mlogit error

2013-05-30 Thread Gary Dong
Hi, Graham, Thank you for sharing this. I encountered the same problem. My choice set was unbalanced because some alternatives were not available for some observations. If I forced the choice sets balanced, model estimation results would be biased. However, after including chid.var = "" and alt.va

[R] Fwd: Obtaing the maximum

2013-05-30 Thread Marion Wenty
Hi, or ... a shorter way would be: a1<-c(1,2,3,4,5,1,2,3,1,1,1,2,3,4,5,1,2,3) a1[c(which(diff(a1)!=1),length(a1))] Hope it helps. Marion -- Forwarded message -- From: arun Date: 2013/5/29 Subject: Re: [R] Obtaing the maximum To: R help Hi, May be this helps: a1<-c(1:5,1:3,

[R] "mlogit" does not report number of observation?

2013-05-30 Thread Gary Dong
Dear R users, I am wondering if there is an easy way to have "mlogit" to report number of observations (N) used in the model. It seems "summary()" does not work. Thank you! Gary [[alternative HTML version deleted]] __ R-help@r-project.org mail

Re: [R] write table without quotation marks in column names....

2013-05-30 Thread John Kane
?write.table write.table(cars, quote=FALSE) John Kane Kingston ON Canada > -Original Message- > From: wewol...@gmail.com > Sent: Thu, 30 May 2013 10:13:26 +0200 > To: r-help@r-project.org > Subject: [R] write table without quotation marks in column names > > Hi > > write.table >

Re: [R] More discussion on R usage statistics

2013-05-30 Thread Liviu Andronic
On Thu, May 30, 2013 at 2:40 PM, Johnny Zhang wrote: > I'd be very happy to change its name and welcome any input on another name. > Zhiyong > collect_rstats or RCollectStats or a variation thereof would do just fine. My 2 cents, Liviu > > > From: Michael Weyl

[R] Mixture of beta distributions

2013-05-30 Thread Jim Silverton
Hi, I am looking for an R package that can handle a mixture of two beta continuous distributions or a mixture of two beta discrete discrete distributions. Is it possible to force the distributions to be either strictly increasing or strictly decreasing? If there are papers out there can you sen m

Re: [R] measuring distances between colours?

2013-05-30 Thread John Fox
Dear Eik, Your code is better than mine. In my application, I convert at most 8 colours at a time, so I paid attention to avoiding repeatedly redefining the local hex2decimal() function and the hsv vector, but not to the efficiency of hex2decimal(). Thanks for this, John > -Original Message

Re: [R] measuring distances between colours?

2013-05-30 Thread John Fox
Dear Martin, > -Original Message- > From: Martin Maechler [mailto:maech...@stat.math.ethz.ch] > Sent: Thursday, May 30, 2013 9:18 AM > To: John Fox > Cc: r-help@r-project.org > Subject: Re: [R] measuring distances between colours? > > Dear John, > > > John Fox > > on Thu, 30

[R] T statistic exactRankTests package

2013-05-30 Thread Al Zou
I understand this might be a silly question, but I have problems understanding the statistic term returned in most permutation packages. for example: x<-c(8,4,6) y<-c(5,3,4) res<-exactRankTests::perm.test(x,y,paired=TRUE) 1-sample Permutation Test data: x and y T = 6, p-value = 0.25 alt

Re: [R] measuring distances between colours?

2013-05-30 Thread Eik Vettorazzi
Hi John, i would propose a one-liner for the hexcode transformation: hex2dec<-function(hexnums)sapply(strtoi(hexnums,16L),function(x)x%/%256^(2:0)%%256) #instead of hexnumerals <- 0:15 names(hexnumerals) <- c(0:9, LETTERS[1:6]) hex2decimal <- function(hexnums){ hexnums <- strsplit(hexnums

Re: [R] measuring distances between colours?

2013-05-30 Thread Martin Maechler
> John Fox > on Thu, 30 May 2013 08:51:10 -0400 writes: > Dear Ken, > Yes, that's the paper I was trying to remember, along with the associated spaces. I'll probably get a better solution using the colorspace package. I'm not sure. Some of the colorspace package features

Re: [R] measuring distances between colours?

2013-05-30 Thread Martin Maechler
Dear John, > John Fox > on Thu, 30 May 2013 08:13:19 -0400 writes: > Dear r-helpers, > I'm interested in locating the named colour that's "closest" to an arbitrary RGB colour. Hmm, maybe I was not really marketing well enough what I had added for R 3.0.0 : ---

Re: [R] measuring distances between colours?

2013-05-30 Thread John Fox
Dear Ken, Yes, that's the paper I was trying to remember, along with the associated spaces. I'll probably get a better solution using the colorspace package. Thanks, John On Thu, 30 May 2013 12:36:11 + Ken Knoblauch wrote: > John Fox mcmaster.ca> writes: > > I'm interested in locating t

Re: [R] measuring distances between colours?

2013-05-30 Thread John Fox
Hi Jim, Thanks for this. Ben's function makes comparisons in the RGB rather than the HSV colour space; works on the decimal rather than hex representation of colours; applies to a single colour rather than a vector; recomputes the CSV representation of the named colours each time it's called

Re: [R] More discussion on R usage statistics

2013-05-30 Thread Johnny Zhang
I'd be very happy to change its name and welcome any input on another name. Zhiyong From: Michael Weylandt Cc: "r-help@r-project.org" Sent: Wednesday, May 29, 2013 5:26 PM Subject: Re: [R] More discussion on R usage statistics Interesting idea but would y

Re: [R] measuring distances between colours?

2013-05-30 Thread Ken Knoblauch
John Fox mcmaster.ca> writes: > I'm interested in locating the named colour that's "closest" to an arbitrary RGB colour. The best that I've > been able to come up is the following, which uses HSV colours for the comparison: > > r2c <- function(){ > hexnumerals <- 0:15 > names(hexnumeral

Re: [R] measuring distances between colours?

2013-05-30 Thread Jim Lemon
On 05/30/2013 10:13 PM, John Fox wrote: Dear r-helpers, I'm interested in locating the named colour that's "closest" to an arbitrary RGB colour. The best that I've been able to come up is the following, which uses HSV colours for the comparison: r2c<- function(){ hexnumerals<- 0:15

[R] measuring distances between colours?

2013-05-30 Thread John Fox
Dear r-helpers, I'm interested in locating the named colour that's "closest" to an arbitrary RGB colour. The best that I've been able to come up is the following, which uses HSV colours for the comparison: r2c <- function(){ hexnumerals <- 0:15 names(hexnumerals) <- c(0:9, LETTERS[1:6])

Re: [R] write table without quotation marks in column names....

2013-05-30 Thread Duncan Murdoch
On 13-05-30 4:28 AM, Pascal Oettli wrote: Hi, Did you read the help page? ?write.table Arguments quote a logical value (TRUE or FALSE) or a numeric vector. If TRUE, any character or factor columns will be surrounded by double quotes. If a numeric vector, its elements are taken as the indic

Re: [R] Subset a floating point vector using all.equal?

2013-05-30 Thread Rui Barradas
Hello, You can write a helper function. are.equal <- function(x, y, eps = .Machine$double.eps^0.5) abs(x - y) < eps x[are.equal(x, 0.15)] Hope this helps, Rui Barradas Em 30-05-2013 02:27, Peter Lomas escreveu: Hello, I have a whole bunch of data to two decimal places. I've done some ari

Re: [R] question

2013-05-30 Thread Pascal Oettli
Check out the CRAN task view on Robust Statistical Methods: http://cran.r-project.org/web/views/Robust.html and on Multivariate Statistics: http://cran.r-project.org/web/views/Multivariate.html Regards, Pascal On 05/30/2013 05:07 PM, nafiseh hagiaghamohammadi wrote: Hi my data has four res

Re: [R] [BioC] comparing two tables

2013-05-30 Thread tomkina
Hello, I have the similar task. I have two tables and I need to get the third table containing data from both of them with extra column with information of what data from which table: table1 chr pos ref alt chr15 A G chr18 T C chr2

Re: [R] write table without quotation marks in column names....

2013-05-30 Thread Pascal Oettli
Hi, Did you read the help page? ?write.table Arguments quote a logical value (TRUE or FALSE) or a numeric vector. If TRUE, any character or factor columns will be surrounded by double quotes. If a numeric vector, its elements are taken as the indices of columns to quote. In both cases, r

[R] question

2013-05-30 Thread nafiseh hagiaghamohammadi
Hi my data has four response variable and five predict variable  and I want to apply multivariate quantile regression ,Is there method for  it whit R? Thanks your advice [[alternative HTML version deleted]] __ R-help@r-project.org mailing l

[R] write table without quotation marks in column names....

2013-05-30 Thread Witold E Wolski
Hi write.table likes to quote (") the column and row names. Is there a way to switch it off? Witold [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the post

Re: [R] error in rowSums in data.table

2013-05-30 Thread Rainer Schuermann
On Thursday 30 May 2013 02:57:04 Camilo Mora wrote: > do you know why is this? or is there another way to sum by row in a > given number of columns? Without data.table: x <- structure(list(col1 = c(NA, 0, -0.015038, 0.003817, -0.011407 ), col2 = c(0.003745, 0.007463, -0.007407, -0.003731, -0.00