Re: [R] If commands in a while loop

2013-11-20 Thread Hlebtomane
Oh I forgot to mention that I had the standard normal distributed RVs in the exponent to form V5. Otherwise it would make no sense. -- View this message in context: http://r.789695.n4.nabble.com/If-commands-in-a-while-loop-tp4680775p4680793.html Sent from the R help mailing list archive at

[R] Functional Programming patterns

2013-11-20 Thread mohan . radhakrishnan
Hi, ' Not specific to 'R'. I search for patterns and found http://patternsinfp.wordpress.com/ which is too heavy for me. There is a 'Pragmatic Programmer' book on such patterns for Scala and Clojure. Is there anything for R ? I wanted to code this. Is there a functional pattern in R for

Re: [R] Functional Programming patterns

2013-11-20 Thread Suzen, Mehmet
Have you checked the r.lambda package of Brian Lee Yung Rowe ? http://cran.r-project.org/web/packages/lambda.r/index.html On 20 November 2013 10:02, mohan.radhakrish...@polarisft.com wrote: Hi, ' Not specific to 'R'. I search for patterns and found http://patternsinfp.wordpress.com/ which

[R] To transform an adjacency matrix

2013-11-20 Thread Arnaud Michel
Hi I have the following problem I would like to build, from a matrix filled with 0 and with 1, a matrix or a data.frame which contains, in every line, the number of the line and the number of the column of the matrix for which the value is equal to 1. Exemple : dput(m) structure(c(0, 0, 0, 1,

Re: [R] To transform an adjacency matrix

2013-11-20 Thread Pascal Oettli
Hello, One approach is: m - structure(c(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0), .Dim = c(5L, 5L)) out - which(m==1, arr.ind=TRUE) out[order(out[,1]),] Regards, Pascal On 20 November 2013 19:28, Arnaud Michel michel.arn...@cirad.fr wrote: Hi I have the

Re: [R] Repeated measures with categorical data

2013-11-20 Thread Duncan Mackay
Also take a look at packages multgee repolr and VGAM, particularly repolr if your data does not fit the PO model Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original Message-

[R] help with converting a data frame into object of class track

2013-11-20 Thread Nachiket Kelkar
Dear R users, I am trying to run a Bayesian change point analysis on a time series with the R package bcpa. However, the data file needs to be of the class track. My data file is at present a three-column data frame (Time, X and Y coordinates) and I am unable to change to class track using

Re: [R] Multiple if statement in loop condition

2013-11-20 Thread Carl Witthoft
What this message means is that a { showed up when some other bracket was unpaired. In this case, if you check your code, you'll see that if(MatriceDist[i,j] 0 ((vectorID[i] 0 | vectorID[j] 0)) is lacking a closing ) for the if clause. Phalaen wrote Hi! I am a Phd student in the

Re: [R] To transform an adjacency matrix

2013-11-20 Thread Arnaud Michel
Thank you Pascal Its fine Michel Le 20/11/2013 11:55, Pascal Oettli a écrit : Hello, One approach is: m - structure(c(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0), .Dim = c(5L, 5L)) out - which(m==1, arr.ind=TRUE) out[order(out[,1]),] Regards, Pascal On 20

Re: [R] Functional Programming patterns

2013-11-20 Thread Hadley Wickham
I have some notes on functional programming in R at http://adv-r.had.co.nz/. Hadley On Wed, Nov 20, 2013 at 3:02 AM, mohan.radhakrish...@polarisft.com wrote: Hi, ' Not specific to 'R'. I search for patterns and found http://patternsinfp.wordpress.com/ which is too heavy for me. There is a

Re: [R] regression by group summary error

2013-11-20 Thread arun
Hi Catalin, I tried with a subset of the variables.  Infact, there is an option in lmList() to subset biN - bi[,c(1,3,22,34)] str(biN) 'data.frame':    66 obs. of  4 variables:  $ Exp  : chr  B B B B ...  $ Clona    : Factor w/ 5 levels A4A,AF2,Max4,..: 3 3 3 3 3 3 3 3 3 3 ...  $

[R] Parametrizing heading in tables package

2013-11-20 Thread Jean-Louis Abitbol
Dear R-Helpers, I am using the (great) tables package in a function this way: parplot - function (x){ test - pkqps[pkqps$estimate == x,] #some plotting # tab - tabular((Heading(Analyte)*(analyte) * Heading(Site)* (fsite)) ~ (n=1)+

Re: [R] Parametrizing heading in tables package

2013-11-20 Thread Duncan Murdoch
On 20/11/2013 9:17 AM, Jean-Louis Abitbol wrote: Dear R-Helpers, I am using the (great) tables package in a function this way: parplot - function (x){ test - pkqps[pkqps$estimate == x,] #some plotting # tab - tabular((Heading(Analyte)*(analyte) * Heading(Site)* (fsite)) ~

Re: [R] How to create running averages

2013-11-20 Thread arun
Hi, Not sure if this is what you wanted. mydf[,1] - mydf[,1]+ISOdatetime(1970,1,1,0,0,0) library(zoo)  z1 - zoo(mydf[,2],mydf[,1]) fun1 - function(z,n,k){  unlist(lapply(split(z,((seq_along(z)-1) %/% n) +1), function(x) rollapply(c(rep(NA,k),x),width=n,mean,na.rm=TRUE)),use.names=FALSE)  }

Re: [R] To transform an adjacency matrix

2013-11-20 Thread David Carlson
indx - arrayInd(which(m0), .dim=c(5, 5)) indx [,1] [,2] [1,]41 [2,]23 [3,]43 [4,]24 [5,]15 # If you want the result sorted indx[order(indx[,1], indx[,2]),] [,1] [,2] [1,]15 [2,]23 [3,]24 [4,]41 [5,]43

Re: [R] R Beginner - Need Perhaps 5 - 10 Minutes of R User Time to Learn Few Basics

2013-11-20 Thread Ista Zahn
On Mon, Nov 18, 2013 at 8:45 AM, PIKAL Petr petr.pi...@precheza.cz wrote: Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Zach Feinstein Sent: Wednesday, November 13, 2013 2:57 PM To: r-help@r-project.org Subject: [R] R

Re: [R] (no subject)

2013-11-20 Thread William Dunlap
fitdistr(y, chi-squared, start = list(4), method = Brent, lower=0.9, upper=3) First, it would be nice if your mail had a subject line and you showed the error message you got from this command. I got: z - fitdistr(y, chi-squared, start = list(4), method=Brent, lower=0.9, upper=3) z

Re: [R] Multiple if statement in loop condition

2013-11-20 Thread David Winsemius
On Nov 20, 2013, at 4:24 AM, Carl Witthoft wrote: What this message means is that a { showed up when some other bracket was unpaired. In this case, if you check your code, you'll see that if(MatriceDist[i,j] 0 ((vectorID[i] 0 | vectorID[j] 0)) is lacking a closing ) for the if

Re: [R] Overlay boxplot and scatter.smooth line

2013-11-20 Thread jlh.membership
Same thing using ggplot... # your data x - c(rep(1,100),rep(2,100),rep(3,100)) y - c(rnorm(100,1),rnorm(100,2),rnorm(100,3)) df - data.frame(x=x, y=y) library(ggplot2) ggp - ggplot(df) + labs(x=X, y=Y) ggp - ggp + geom_boxplot(aes(x=factor(x), y=y)) ggp - ggp + geom_smooth(formula=y~x,

Re: [R] Setting axis scale for a boxplot

2013-11-20 Thread David Arnold
Thanks, these replies worked. D. -- View this message in context: http://r.789695.n4.nabble.com/Setting-axis-scale-for-a-boxplot-tp4680704p4680821.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] RCmdr issues

2013-11-20 Thread Laura Vossen
I have the same problem with my macbook air (OS X 10.9) -- View this message in context: http://r.789695.n4.nabble.com/RCmdr-issues-tp4680537p4680804.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Binomial GLM in Stata and R

2013-11-20 Thread Floor Biemans
Hello, I'm not a Stata user so I'm trying to reproduce Stata results that are given to me in R. I would like to use a GLM with a complementary log-log function. The stata code I have is: glm c IndA fia, family(binomial s) link(cloglog) offset(offset) The R code is: glmt -

Re: [R] Multiple if statement in loop condition

2013-11-20 Thread Phalaen
Thank you! Elisa 2013/11/20 Carl Witthoft [via R] ml-node+s789695n4680803...@n4.nabble.com What this message means is that a { showed up when some other bracket was unpaired. In this case, if you check your code, you'll see that if(MatriceDist[i,j] 0 ((vectorID[i] 0 | vectorID[j] 0))

Re: [R] Datatable manipulation

2013-11-20 Thread Nitisha jha
Thanks a lot. It worked :) On Wed, Nov 20, 2013 at 9:44 AM, arun smartpink...@yahoo.com wrote: Hi, Try: dat1 - read.table(text=a b c x 1 4 7 y 2 5 8 z 3 6 9,header=TRUE) dat2 - dat1 #either library(reshape2) res1 -

Re: [R] Split type in the RandomForest package

2013-11-20 Thread Liaw, Andy
Classification trees use the Gini index, whereas the regression trees use sum of squared errors. They are hard-wired into the C/Fortran code, so not easily changeable. Best, Andy -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of

[R] R NNET object Question

2013-11-20 Thread Brian Behe
Greetings! After generating a neural network based on a given data set (the data set consists of two input variables and 1 output variable), I get the following output from calling the summary function on the resulting Neural Network object (using the nnet package): summary(nnetModel) a 2-3-1

[R] How to stop Kaplan-Meier curve at a time point

2013-11-20 Thread Dr.Vinay Pitchika
Hello R users I have a question with Kaplan-Meier Curve with respect to my research. We have done a retrospective study on fillings in the tooth and their survival in relation to the many influencing factors. We had a long follow-up time (upto 8yrs for some variables). However, we decided to stop

Re: [R] RCmdr issues

2013-11-20 Thread John Fox
Dear Laura, I assume that you're responding to the message that I posted on R-SIG-Mac. If so, I'm not sure why you switched to R-help nor why you changed the subject of the message. Please see the subsequent messages on R-SIG-Mac under the subject Problems with Rcmdr via XQuartz on OSX

[R] nlme function summary.lmList cannot be found with new versions

2013-11-20 Thread megan herting
Hello, I installed the newest version of R (3.0.2) as well as the newest version of nlme (3.1-113) in order to use summary.lmList and other nlme functions. Once loading the new library, lmList and summary.lm can be found, but a number of additional functions cannot be found via command.

[R] Percentiles for unequal probability sample

2013-11-20 Thread Trevor Walker
I often work with tree data that is sampled with probability proportional to size, which presents a special challenge when describing the frequency distribution. For example, R functions like quantile() and fitdistr() expect each observation to have equal sample probability. As a workaround, I

[R] bias in AUCRF?

2013-11-20 Thread Jack Luo
Hi, I am using the AUCRF package for my data and I was firstly impressed by the high performance of OOB-AUC. But after a while, I feel it might be due to some sort of bias, which motivates me to use random data (generated using rnorm) for a test. The design is very simple: 100 observations with

[R] balanced design package?

2013-11-20 Thread Dimitri Liakhovitski
Dear everybody, I have 20 levels of a factor. I want to create 1000 combinations of 6 different levels of that factor so that each level is repeated about the same number of times (across 100 combinations) and so that the number of times level X is combined with level Y is also about the same

Re: [R] nlme function summary.lmList cannot be found with new versions

2013-11-20 Thread Ben Bolker
megan herting mherting at chla.usc.edu writes: Hello, I installed the newest version of R (3.0.2) as well as the newest version of nlme (3.1-113) in order to use summary.lmList and other nlme functions. Once loading the new library, lmList and summary.lm can be found, but a number

Re: [R] Inverse of Probit

2013-11-20 Thread Ben Bolker
David Winsemius dwinsemius at comcast.net writes: On Nov 19, 2013, at 10:59 AM, Calum wrote: Hi there, I hope someone can help me. I have a dataset of Concentration against Mortality, and I am trying to compare the use of Logit and Probit models using this data. [snip snip

Re: [R] Binomial GLM in Stata and R

2013-11-20 Thread Ben Bolker
Floor Biemans floor_biemans at hotmail.com writes: [snip] The stata code I have is: glm c IndA fia, family(binomial s) link(cloglog) offset(offset) The R code is: glmt - glm(data=dataset, c ~ IndA + fia, offset = offset, family = binomial(link = cloglog)) Which yields different

Re: [R] Percentiles for unequal probability sample

2013-11-20 Thread Adams, Jean
Rather than exploding, I suggest you order your data according to tree diameter, then calculate the cumulative sum of the tree densities, and use linear interpolation to estimate the percentiles. For example ... library(plotrix) attach(trees.df) ord - order(Diameter) CumDensOrdScaled -

Re: [R] nlme function summary.lmList cannot be found with new versions

2013-11-20 Thread Prof Brian Ripley
On 20/11/2013 21:42, Ben Bolker wrote: megan herting mherting at chla.usc.edu writes: Hello, I installed the newest version of R (3.0.2) as well as the newest version of nlme (3.1-113) in order to use summary.lmList and other nlme functions. Once loading the new library, lmList and

Re: [R] balanced design package?

2013-11-20 Thread Jim Lemon
On 11/21/2013 08:41 AM, Dimitri Liakhovitski wrote: Dear everybody, I have 20 levels of a factor. I want to create 1000 combinations of 6 different levels of that factor so that each level is repeated about the same number of times (across 100 combinations) and so that the number of times level

Re: [R] How to stop Kaplan-Meier curve at a time point

2013-11-20 Thread David Winsemius
On Nov 20, 2013, at 12:01 PM, Dr.Vinay Pitchika wrote: Hello R users I have a question with Kaplan-Meier Curve with respect to my research. We have done a retrospective study on fillings in the tooth and their survival in relation to the many influencing factors. We had a long follow-up

Re: [R] bias in AUCRF?

2013-11-20 Thread David Winsemius
On Nov 20, 2013, at 12:44 PM, Jack Luo wrote: Hi, I am using the AUCRF package for my data and I was firstly impressed by the high performance of OOB-AUC. But after a while, I feel it might be due to some sort of bias, which motivates me to use random data (generated using rnorm) for a

Re: [R] Percentiles for unequal probability sample

2013-11-20 Thread David Winsemius
On Nov 20, 2013, at 11:35 AM, Trevor Walker wrote: I often work with tree data that is sampled with probability proportional to size, which presents a special challenge when describing the frequency distribution. For example, R functions like quantile() and fitdistr() expect each

[R] integrate

2013-11-20 Thread dan wang
Hi all, Can anyone help me with below integrate function? Basically, I want to calculate the integral of the sum of two kernel density functions. But the error shows that: In x - a : longer object length is not a multiple of shorter object length y1 = rnorm(10) y2 = rnorm(10) fhat -

Re: [R] integrate

2013-11-20 Thread David Winsemius
On Nov 20, 2013, at 7:12 PM, dan wang wrote: Hi all, Can anyone help me with below integrate function? Basically, I want to calculate the integral of the sum of two kernel density functions. But the error shows that: In x - a : longer object length is not a multiple of shorter

Re: [R] integrate

2013-11-20 Thread David Winsemius
On Nov 20, 2013, at 8:39 PM, David Winsemius wrote: On Nov 20, 2013, at 7:12 PM, dan wang wrote: Hi all, Can anyone help me with below integrate function? Basically, I want to calculate the integral of the sum of two kernel density functions. But the error shows that: In x - a :

[R] Thoughts for faster indexing

2013-11-20 Thread Noah Silverman
Hello, I have a fairly large data.frame. (About 150,000 rows of 100 variables.) There are case IDs, and multiple entries for each ID, with a date stamp. (i.e. records of peoples activity.) I need to iterate over each person (record ID) in the data set, and then process their data for each

[R] The profile log-likelihood problem

2013-11-20 Thread smart hendsome
Hi, Im still new to R and I have a problem regarding the code below. I don't know how to solve that. I want to compute profile log-likelihood using the rainfall data. I use the code below from Dunn: tweedie.profile(Amount~Year*Month,p.vec=seq(1.35,1.75,length=50),method=series,do.ci=TRUE)

Re: [R] Convergent Cross Mapping

2013-11-20 Thread Junjie Jiang
在 2013年4月21日星期日UTC+8上午12时02分31秒,Lorenzo Isella写道: Dear All, I am looking for an R implementation of the convergent cross mapping method (see http://bit.ly/XN8OZX and http://www.uvm.edu/~cdanfort/csc-reading-group/sugihara-causality-science-2012.pdf ) The method is presented as

Re: [R] PLS-DA and LV variance with mixOmics

2013-11-20 Thread Betty
Hi Roberto, I need to do the same..did you manage to figure it out? Thanks. On Thursday, September 27, 2012 8:02:56 PM UTC+1, Roberto wrote: Hi all, I need to obtain the LV variance from my PLS-DA analysis. I tried to read the reference manuale of the package, but I do not found

[R] Reverse geocoding Latitude and Longitude to address/name of location

2013-11-20 Thread Vijay Chowdhari
I have a data frame with the column for latitude and another column for longitude. I would like to create a reverse geocoding function that creates another column with the address corresponding to this lat and lon i.e lat lon address 41.4938 -81.9860

Re: [R] How to extract sets of rows (not sorted) from text file in R, do some methods on these rows, save the result in another text file, then pick others set of rows and do the same

2013-11-20 Thread arun
Hi, dat1 - read.csv(Manal.csv,header=FALSE) str(dat1) #'data.frame':    31 obs. of  9 variables: # $ V1: int  1 1 1 1 3 1 2 2 3 2 ... # $ V2: int  1 1 0 0 0 1 0 0 0 0 ... # $ V3: int  0 0 1 0 0 0 0 0 0 0 ... # $ V4: int  1 1 0 0 0 0 0 0 0 0 ... # $ V5: int  0 0 1 0 1 0 0 1 1 0 ... # $ V6: int  0

[R] RStudio and R.app segmentation fault errors

2013-11-20 Thread Earl Brown
R-helpers, I'm using system() to run a shell script that uses a library written in C++ to analyze natural language (FreeLing: http://nlp.lsi.upc.edu/freeling). When I run the following code in RStudio (0.97.248) and R.app (1.62) on Max OSX (10.7.5): cmd - analyze -f

Re: [R] how can I import a number of datsets in a folder in my working directory to a list in R

2013-11-20 Thread arun
Hi, Suppose, if I create 15 files in my working directory. set.seed(48) lapply(1:15,function(i) {m1 - matrix(sample(1:20,1686*2,replace=TRUE),nrow=1686,ncol=2); write.table(m1,paste0(file_,i,.txt),row.names=FALSE,quote=FALSE)})  D -dir() D1 - D[order(as.numeric(gsub(\\D+,,D)))] D1  res -

Re: [R] RStudio and R.app segmentation fault errors

2013-11-20 Thread Jeff Newmiller
Why isn't it as obvious to you as it is to me that this question belongs on the RStudio forum rather than here? --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.us

Re: [R] How to stop Kaplan-Meier curve at a time point

2013-11-20 Thread Thomas Stewart
One solution is to format the data as if the follow-up period ended on day 2190. For example, TTT - Survival_days DDD - Outcome DDD[ TTT2190 ] - 0 TTT[ TTT2190 ] - 2190 survfit(Surv(TTT, DDD) ~ Gender) -tgs On Wed, Nov 20, 2013 at 3:01 PM, Dr.Vinay Pitchika dr.vinay@gmail.comwrote:

Re: [R] can par()$pin be used to guarantee equal horizontal and vertical image lengths?

2013-11-20 Thread Thomas Stewart
How about using the asp option? For example, A - matrix(rnorm(200),20) image(A, asp=ncol(A)/nrow(A)) -tgs On Tue, Nov 19, 2013 at 3:56 AM, Mercutio Florid floridmercu...@yahoo.comwrote: Today at 10:03 AM I use several different versions of R, including RGui on Windows and rstudio on

Re: [R] How to use For loop to read multiple files

2013-11-20 Thread arun
Hi, I guess the trouble is here: lapply(1:4,function(i) {paste((file_,i,.txt),sep=)}) Error: unexpected ',' in lapply(1:4,function(i) {paste((file_,  lapply(1:4,function(i) {paste(file_,i,.txt,sep=)}) #works #or lapply(1:4,function(i) {paste0(file_,i,.txt,sep=)}) A.K. Hi guys im having

Re: [R] How to use For loop to read multiple files

2013-11-20 Thread arun
I forgot to delete the `sep` from the 2nd option:  lapply(1:4,function(i) {paste0(file_,i,.txt)}) A.K. On Thursday, November 21, 2013 1:43 AM, arun smartpink...@yahoo.com wrote: Hi, I guess the trouble is here: lapply(1:4,function(i) {paste((file_,i,.txt),sep=)}) Error: unexpected ',' in

Re: [R] To transform an adjacency matrix

2013-11-20 Thread Arnaud Michel
Thank you also for your help Michel Le 20/11/2013 19:04, Dennis Murphy a écrit : Hi: which(m == 1L, arr.ind = TRUE) Dennis On Wed, Nov 20, 2013 at 2:28 AM, Arnaud Michel michel.arn...@cirad.fr wrote: Hi I have the following problem I would like to build, from a matrix filled with 0 and with

[R] Cost function in cv. glm for a fitted logistic model when cutoff value of the model is not 0.5

2013-11-20 Thread Pedro Carmona Ibáñez
I have a logistic model fitted with the following R function: glmfit-glm(formula, data, family=binomial) A reasonable cutoff value in order to get a good data classification (or confusion matrix) with the fitted model is 0.2 instead of the mostly used 0.5. And I want to use the `cv.glm`