Re: [R] Optimization failed in fitdistr (Weibull distribution)

2013-10-29 Thread peter dalgaard
On 28 Oct 2013, at 13:07 , kmmoon100 k.m...@student.unimelb.edu.au wrote: Hello everyone, This is Kangmin. I am trying to produce shape and scale of my wind data. My data is based on wind speed frequency with 1km/hr increment. data is described below. Windspeed (km/h)Frequency 1

[R] Showing a reduced Time series in a plot

2013-10-29 Thread Baro
Hi experts, I have a Time serie like this T=(12,13,14,20,65,78,85,35) I do a Transformation on this series and then I have: T ' =(17.22009 27.96722 111.16376 71.33732) I want to show T ' on the plot, but on X-Axis I want to have 8 values, for the first two value on x-axis -17.22009

Re: [R] coxph: how to define interaction terms?

2013-10-29 Thread rm
Any ideas would be much appreciated; I suspect that this problem of constructing the dummies applies not only to function coxph but to other regression models in R as well. Effectively, my question is how to better control for which dummies and interactions to include in the model and which not.

[R] TelosB external modules, guide

2013-10-29 Thread Alaios
Hi all, I would like to ask your help regarding connecting external modules to telosb. I have found that tiny os offers many possibilities for that as ADC, GPIOs, SPI, UART, I2C I have never learned anything regarding those. Can someone please let me know if there is any simple guide on these

Re: [R] TelosB external modules, guide

2013-10-29 Thread Berend Hasselman
On 29-10-2013, at 12:57, Alaios ala...@yahoo.com wrote: Hi all, I would like to ask your help regarding connecting external modules to telosb. I have found that tiny os offers many possibilities for that as ADC, GPIOs, SPI, UART, I2C I have never learned anything regarding those. Can

Re: [R] speed of makeCluster (package parallel)

2013-10-29 Thread Arnaud Mosnier
Thanks Brian, I thought that forking clusters was better ... but as you mentioned, it is not available on windows. Unfortunately, you do not always choose the OS used by your company ! Arnaud Date: Mon, 28 Oct 2013 17:59:10 + From: Prof Brian Ripley rip...@stats.ox.ac.uk To:

[R] maximum value replacement

2013-10-29 Thread eliza botto
Dear Users, I have two matrices, one with 12 rows and 124 columns(A) and the other with 1 row and 124 column(B). i want to replace the maximum value in all columns of A with each (single) column value of B. How can i do it?? Thanks indeed in advance, Eliza

Re: [R] maximum value replacement

2013-10-29 Thread arun
Hi, Try:  sapply(seq_len(ncol(A)),function(i) {indx - which(A[,i]%in% max(A[,i])); A[,i][indx] - B[,i]; A[,i]}) A.K. On Tuesday, October 29, 2013 10:16 AM, eliza botto eliza_bo...@hotmail.com wrote: Dear Users, I have two matrices, one with 12 rows and 124 columns(A) and the other with 1

[R] How to set default font for lattice graphics?

2013-10-29 Thread Slomo
I tried to change fonts for lattice graphics: trellis.par.set(list(axis.text=list(fontfamily=Monaco), par.strip.text=list(fontfamily=Monaco))) It works for axis.text but not for par.strip.text. trellis.par.set() does not set par.strip.text neither strip.text while I can change font for strip

[R] R CMD check Error: package MASS was built before R 3.0.0 - not true!?

2013-10-29 Thread Christian Hennig
Hi there, I just updated my R to 3.0.2 and ran R CMD check --as-cran on the just produced new version of fpc. I got an error Error: package MASS was built before R 3.0.0: please re-install it - but I actually *did* re-install MASS without error just before that and within R library(MASS)

Re: [R] R CMD check Error: package MASS was built before R 3.0.0 - not true!?

2013-10-29 Thread Jeff Newmiller
Perhaps check your R_LIBS* variables? http://stat.ethz.ch/R-manual/R-devel/library/base/html/libPaths.html --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.us

Re: [R] maximum value replacement

2013-10-29 Thread Bert Gunter
To Eliza: What if the max in a column is not unique? Given the small size of A, the solution given by Arun seems completely adequate. However, I was wondering if it could be done without the R-level loop in sapply by taking advantage of pmax() . Of course it can. Here's code to illustrate how:

Re: [R] maximum value replacement

2013-10-29 Thread eliza botto
Thanks bert!!!it worked out perfectly well.thankyou onceagain, Eliza Date: Tue, 29 Oct 2013 08:30:13 -0700 Subject: Re: [R] maximum value replacement From: gunter.ber...@gene.com To: smartpink...@yahoo.com; eliza_bo...@hotmail.com CC: r-help@r-project.org To Eliza: What if the max in a

[R] sh /bin/sh bad interpreter error when loading certain packages

2013-10-29 Thread Erin Hodgess
Dear R People: I'm on a Centos 5 Red Hat system and I'm trying to install such packages as Cairo, Rserve, etc. However, I keep getting an error: sh:/bin/sh bad interpreter. I'm logged in as root, so it shouldn't be a permissions error. Has anyone else run into this, please? Any help would be

Re: [R] maximum value replacement

2013-10-29 Thread Bert Gunter
... and while I'm being OCD, note that the which() call in my code can and should be omitted. It's completely superfluous. :-( -- Bert On Tue, Oct 29, 2013 at 8:46 AM, eliza botto eliza_bo...@hotmail.com wrote: Thanks bert!!! it worked out perfectly well. thankyou onceagain, Eliza Date:

Re: [R] sh /bin/sh bad interpreter error when loading certain packages

2013-10-29 Thread Rich Shepard
On Tue, 29 Oct 2013, Erin Hodgess wrote: I'm on a Centos 5 Red Hat system and I'm trying to install such packages as Cairo, Rserve, etc. However, I keep getting an error: sh:/bin/sh bad interpreter. Erin, A Web search shows several possible causes, including incorrect options in

[R] R vs octave development strategy (and success)

2013-10-29 Thread Federico Calboli
Hi All, if memory serves me well I recall some paper comparing the relative success in getting mainstream acceptance (as mainstream as statistics can be) of both R and Octave. I remember vaguely that the fact the development strategies (core team vs one main developer) played a major role in

Re: [R] coxph: how to define interaction terms?

2013-10-29 Thread David Winsemius
On Oct 29, 2013, at 4:38 AM, rm wrote: Any ideas would be much appreciated; I suspect that this problem of constructing the dummies applies not only to function coxph but to other regression models in R as well. Effectively, my question is how to better control for which dummies and

[R] Regular Expression returning unexpected results

2013-10-29 Thread Lopez, Dan
Hi, So I just took an intro to R programming class and one of the lectures was on Regular Expressions. I've been playing around with various R functions that use Regular Expressions. But this has me stumped. This was part of a quiz and I got it right through understanding the syntax. But when

Re: [R] Inscrutable error message in mgcv: 1 prediction = predict(MI, se.fit=TRUE, newdata=rhc), Error in if (object$inter) X[[i]] - PredictMat(object$margin[[i]], dat, : , argument is of length zer

2013-10-29 Thread Simon Wood
Sorry, this relates to ?mgcv-FAQ number 5, unfortunately. 'ti' terms were introduced as a much better and cleaner way of allowing smooth main effects and interactions where the interactions are based on 'te' terms: this required some re-engineering of the tensor product smooth objects (the

Re: [R] sh /bin/sh bad interpreter error when loading certain packages

2013-10-29 Thread COLLINL
On Tue, 29 Oct 2013, Erin Hodgess wrote: I'm on a Centos 5 Red Hat system and I'm trying to install such packages as Cairo, Rserve, etc. However, I keep getting an error: sh:/bin/sh bad interpreter. Erin, just to add to what Rich wrote, this may be a disk related result as well. I get

Re: [R] Heteroscedasticity and mgcv.

2013-10-29 Thread Simon Wood
(1) Am I correct in understanding that Heteroscedasticity is a problem for Generalized Additive Models as it is for standard linear models? I am asking particularly about the GAMs as implemented in the mgcv package. Based upon my online search it seems that some forms of penalized splines can

Re: [R] Heteroscedasticity and mgcv.

2013-10-29 Thread COLLINL
Thank you Simon that's quite helpful! I'll compare that with the GLMSS models. Best, Collin. (1) Am I correct in understanding that Heteroscedasticity is a problem for Generalized Additive Models as it is for standard linear models? I am asking particularly about the GAMs

Re: [R] R vs octave development strategy (and success)

2013-10-29 Thread David Carlson
This covers the topic you mention, but from the perspective of the role of the R Core team. The point about Octave is a single sentence/footnote: Fox, John. 2009. Aspects of the Social Organization and Trajectory of the R Project. The R Journal 1/2: 5-13.

Re: [R] Regular Expression returning unexpected results

2013-10-29 Thread Sarah Goslee
On Tue, Oct 29, 2013 at 1:13 PM, Lopez, Dan lopez...@llnl.gov wrote: grep(^([a-z]+) +\1 +[a-z]+ [0-9],lines) Your expression has a typo: R grep(^([a-z]+) +\\1 +[a-z]+ [0-9],lines) [1] 2 -- Sarah Goslee http://www.functionaldiversity.org __

Re: [R] Regular Expression returning unexpected results

2013-10-29 Thread Jeff Newmiller
Please read and follow the Posting Guide, in particular re plain text email. You need to keep in mind that the characters in literal strings in R source have to make it into RAM before the regex code can parse it. Since regex needs a single backslash to escape normal parsing and interpret 1 as

Re: [R] sh /bin/sh bad interpreter error when loading certain packages

2013-10-29 Thread Erin Hodgess
Thanks for the good suggestions! This is how I solved it (with lots of internet help): Create a tempdir. Do a chmod 777 on it. Within R Sys.setenv(TMPDIR=/home/erin/tempdir) install.packages(Cairo,depen=TRUE) and all was well. Thanks, Erin On Tue, Oct 29, 2013 at 12:24 PM,

Re: [R] R vs octave development strategy (and success)

2013-10-29 Thread peter dalgaard
This is from the other perspective http://www.r-project.org/conferences/DSC-2001/Proceedings/Eaton.pdf I can’t spot any direct comparison (and there is no mention of R in the references), but I recall the ideas contrasting the two projects being bandied about at the time. That discussion is

Re: [R] Regular Expression returning unexpected results

2013-10-29 Thread David Carlson
From ?regex (do remember that backslashes need to be doubled when entering R character strings, e.g. from the keyboard). lines[grep(^([a-z]+) +\\1 +[a-z]+ [0-9],lines)] [1] night night at 8 - David L Carlson Department of Anthropology Texas AM University

Re: [R] Regular Expression returning unexpected results

2013-10-29 Thread Lopez, Dan
Hi Jeff, I was reviewing my old lecture notes and see that the professor did use \1 so I think he was talking about regex in a non-platform specific context. But obviously \\1 is the way to do it in R. The examples you gave me to study really helped. I was also going to ask how to identify

Re: [R] R CMD check Error: package MASS was built before R 3.0.0 - not true!?

2013-10-29 Thread Dirk Eddelbuettel
Christian Hennig ucakche at ucl.ac.uk writes: I just updated my R to 3.0.2 and ran R CMD check --as-cran on the just produced new version of fpc. I got an error Error: package MASS was built before R 3.0.0: please re-install it - but I actually *did* re-install MASS without error just

[R] mapping data to a geographic map of Europe

2013-10-29 Thread paladini
Hello, I would like to draw a map of Europe. Each country should be colored depending on how it scores in an index called GPIndex. Say a dark red for real bad countries a light red for those which are not so bad, light blue for the fairly good ones and so on up to the really good ones in a

[R] calculating quantiles

2013-10-29 Thread Rossenu, Stefaan
Hi, I'm having the following loop: result - vector(list,100) for (i in 1:max(dat$simNumber)) { result[[i]]-survfit(Surv(dat[dat$simNumber==i,]$TAFD,dat[dat$simNumber==i,]$DV)~1) } In a next step, I would like to calculate the mean, 5% and 95% PI of the Kaplan-Meier estimates of the 100

Re: [R] R CMD check Error: package MASS was built before R 3.0.0 - not true!?

2013-10-29 Thread Hennig, Christian
Dear Jeff, thanks. Somehow R didn't install MASS where it later looked for it. I still haven't understood properly what caused the problem but I managed to fix it now (by specifying lib when installing it). Best wishes, Christian *** --- *** Christian Hennig University College London,

Re: [R] 'yum install R' failing with tcl/tk issue

2013-10-29 Thread Michael Stauffer
Thanks everyone for the replies to my question. The issue turns out to be that I'm on a Rocks cluster head node, and the Rocks distribution disables alternate repos by defaut so it's using the Rocks-6.1 repo which has the old R. In the meantime I've built R 3.0.2 from source, which seems a better

[R] How to save very large matrix?

2013-10-29 Thread Petar Milin
Hello! I have a very large matrix of results: 5x10. I saved it as RDS, but I would also need to save it as txt or csv. Is there a way to do it? Now, with write.table I am receiving an error: Error in .External2(C_writetable, x, file, nrow(x), p, rnames, sep, eol, : long vectors not

[R] (gam) formula: Why different results for terms being factor vs. numeric?

2013-10-29 Thread Marius Hofert
Dear expeRts, If I specify group = as.factor(rep(1:2, each=n)) in the below definition of dat, I get the expected behavior I am looking for. I wonder why I don't get it if group is *not* a factor... My guess was that, internally, factors are treated as natural numbers (and this indeed seems to be

[R] R function to locate Excel sheet?

2013-10-29 Thread Ron Michael
Hi, I am looking for some R function which will tell me, whether a particular sheet in an Excel file (.xlsx/.xls) exists or not. I just need to get some TRUE/FALSE type of answer. Can somebody give me any pointer if such function exists or not? Thanks and regards,

Re: [R] mapping data to a geographic map of Europe

2013-10-29 Thread Adams, Jean
Check out this link for some examples http://www.r-bloggers.com/maps-in-r-choropleth-maps/ Jean On Tue, Oct 29, 2013 at 12:02 PM, palad...@trustindata.de wrote: Hello, I would like to draw a map of Europe. Each country should be colored depending on how it scores in an index called

Re: [R] (gam) formula: Why different results for terms being factor vs. numeric?

2013-10-29 Thread Bert Gunter
Think about it. How can one define a smooth term with a factor??? Further discussion is probably offtopic. Post on stats.stackexchange.com if it still isn't obvious. Cheers, Bert On Tue, Oct 29, 2013 at 1:16 PM, Marius Hofert marius.hof...@math.ethz.ch wrote: Dear expeRts, If I specify group

Re: [R] How to save very large matrix?

2013-10-29 Thread Adams, Jean
Have you tried write.csv() or write.matrix()? I really don't know, but they may be more efficient than write.table() with large matrices. Jean On Tue, Oct 29, 2013 at 2:27 PM, Petar Milin pmi...@gmail.com wrote: Hello! I have a very large matrix of results: 5x10. I saved it as RDS,

Re: [R] mapping data to a geographic map of Europe

2013-10-29 Thread Jim Lemon
On 10/30/2013 04:02 AM, palad...@trustindata.de wrote: Hello, I would like to draw a map of Europe. Each country should be colored depending on how it scores in an index called GPIndex. Say a dark red for real bad countries a light red for those which are not so bad, light blue for the fairly

Re: [R] Optimization failed in fitdistr (Weibull distribution)

2013-10-29 Thread Rolf Turner
On 10/29/13 19:44, peter dalgaard wrote: SNIP There really is no substitute for knowledge and understanding! Did it not occur to you that the Windspeed column needs to enter into your analysis? SNIP Fortune! cheers, Rolf Turner

[R] Conditional wald statistics in ASRemlR

2013-10-29 Thread Sue Lewis
Hi, I'm running a model in ASRemlR and the conditional wald statistics table is producing groupings for the marginality of some variables (A's B's and C's in the tables below) that we are struggling to understand. From our understanding of the model we are fitting and the reference manual, we were

Re: [R] R function to locate Excel sheet?

2013-10-29 Thread andrija djurovic
Hi here is the solutions using XLConnect package: library(XLConnect) wb - loadWorkbook(path to your Excel file) c(particular sheet name)%in%getSheets(wb) Andrija On Tue, Oct 29, 2013 at 9:26 PM, Ron Michael ron_michae...@yahoo.comwrote: Hi, I am looking for some R function which will

Re: [R] R function to locate Excel sheet?

2013-10-29 Thread Adams, Jean
You could use the XLConnect package to do this. For example, something like this might do the trick ... library(XLConnect) mysheet - Sheet4 wb - loadWorkbook(C:/temp/MyData.xlsx) wbsheets - getSheets(wb) mysheet %in% wbsheets Jean On Tue, Oct 29, 2013 at 3:26 PM, Ron Michael

Re: [R] How to save very large matrix?

2013-10-29 Thread Rui Barradas
Hello, You can use the argument to write.csv or write.table append = TRUE to write the matrix in chunks. Something like the following. bigwrite - function(x, file, rows = 1000L, ...){ passes - NROW(x) %/% rows remaining - NROW(x) %% rows k - 1L

Re: [R] Automatically Remove Aliased Terms from a Model

2013-10-29 Thread Eik Vettorazzi
Hi Thorn, it is not entirely clear (at least for me) what you want to accomplish. an easy and fail safe way of extracting used terms in a (g)lm-object is names(model.frame(l)) if you want to extract terms to finally select a model, have a look at drop1 and/or MASS::dropterm Hth Am 28.10.2013

Re: [R] Mean error

2013-10-29 Thread arun
Hi, Try either: res1 - apply(mydata[,1:2],2,mean)  res2 - colMeans(mydata[,1:2])  identical(res1,res2) #[1] TRUE # Also if you need to find means for each group (Ungrazed vs. Grazed) by(mydata[,-3],mydata[,3],colMeans) #or if column names are V1, V2, V3 aggregate(.~V3,mydata,mean) #or

Re: [R] How to save very large matrix?

2013-10-29 Thread Prof Brian Ripley
On 29/10/2013 20:42, Rui Barradas wrote: Hello, You can use the argument to write.csv or write.table append = TRUE to write the matrix in chunks. Something like the following. That was going to be my suggestion. But the reason long vectors have not been implemented is that is rather

Re: [R] How to save very large matrix?

2013-10-29 Thread Petar Milin
Hello, On Oct 29, 2013, at 10:16 PM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: On 29/10/2013 20:42, Rui Barradas wrote: Hello, You can use the argument to write.csv or write.table append = TRUE to write the matrix in chunks. Something like the following. That was going to be my

[R] Can not read Excel file correctly

2013-10-29 Thread Ron Michael
Hi, I need to read an Excel file which can be available in following link: http://www45.zippyshare.com/v/43626889/file.html Now I wanted to read the 1st sheet of this Excel file. Below are my code so far (I saved that file in 'F:' drive): library(XLConnect) Loading required package: rJava

Re: [R] How to save very large matrix?

2013-10-29 Thread Hervé Pagès
Hi Petar, If you're going to share this matrix across R sessions, save()/load() is probably one of your best options. Otherwise, you could try the rhdf5 package from Bioconductor: 1. Install the package with: source(http://bioconductor.org/biocLite.R;) biocLite(rhdf5) 2. Then:

[R] deparse: replacing all by \

2013-10-29 Thread Jose Claudio Faria
Dear list, I need to use the function deparse in a specific situation. But, it always replace any occurence of by \. For example: arg - deparse(args(cov), width.cutoff = 100L)[1] arg [1] function (x, y = NULL, use = \everything\, method = c(\pearson\, \kendall\, \spearman\)) Some

Re: [R] deparse: replacing all by \

2013-10-29 Thread Duncan Murdoch
On 13-10-29 7:42 PM, Jose Claudio Faria wrote: Dear list, I need to use the function deparse in a specific situation. But, it always replace any occurence of by \. No it doesn't. That's just how print() displays quotes. Use cat() and you can see what's really there. Duncan Murdoch

[R] big speed difference in source btw. R 2.15.2 and R 3.0.2 ?

2013-10-29 Thread Heinz Tuechler
Dear All, is it known that source works much faster in R 2.15.2 than in R 3.0.2 ? In the example below I observe e.g. for a data.frame with 10^7 rows the following timings: R version 2.15.2 Patched (2012-11-29 r61184) length: 1e+07 user system elapsed 62.040.22 62.26 R version

Re: [R] Use correlation matrix to get values for a new data frame

2013-10-29 Thread Greg Snow
I am not sure that I fully understand your question, but the mvrnorm function in the MASS package may do what you want. It will generate multivariate normal data with a specified correlation(covariance). If that is not what you want then try to explain a bit more about what you want your final

[R] add a color bar in a plot

2013-10-29 Thread Alaios
Hi all, I am trying to add a color legend to my plot. As an example I am giving you a bit of code that you can run. I am sharing for everyone a small data snipset that you can load https://www.dropbox.com/s/fh8jhwujgunmtrb/DataToPlotAsImage.Rdata load(DataToPlotAsImage.Rdata) require(plotrix)

Re: [R] merging rows that share columns (but not all of them)

2013-10-29 Thread arun
Hi, May be this helps.  library(plyr) res -  join_all(lapply(my.list,function(x) as.data.frame(t(unlist(x,type=full)  res #  AICc  Intercept   Burned   StandAge TreeDensity RoadDensity Intercept.SE #1 108.2303 -1.3358063 1.351866 0.05606852  -0.1886327 -0.03904008    0.8392739 #2

[R] Fitting multiple horizontal lines to data

2013-10-29 Thread Sashikanth Chandrasekaran
Dear R-users, I am trying to fit my data using one or more horizontal lines. If my data is in y, I understand that lm(y~1) will fit a single horizontal line at mean(y). However, I want to try and fit the data with multiple horizontal lines if that reduces the error while still keeping the number

[R] rpy2 and user defined functions from R

2013-10-29 Thread Erin Hodgess
Hello again! I'm using python with a module rpy2 to call functions from R. It works fine on built in R functions like rnorm. However, I would like to access user-defined functions as well. For those of you who use this, I have: import rpy2.robjects as R x = R.r.buzz(3) R object as no