[R] Subject: Regress multiple independent variables on multiple dependent variables

2013-11-04 Thread Kumar Raj
I want to estimate the effect of several independent variables on several dependent variables. In the example below I wanted to estimate the effect of three independent variables on ozone and temperature. My aim is to create a list of dependent and independent variables and automate the process

[R] Formatting time stamps for weibull distribution

2013-11-04 Thread kmmoon100
Hello everyone, I have been using bReeze package for weibull distribution analysis. In this package, there is a function called 'formatTS' for converting time stamps from string to POSIXlt. (http://rgm3.lab.nig.ac.jp/RGM/R_rdfile?f=bReeze/man/formatTS.Rdd=R_CC) This is a part of process to plot

Re: [R] Formatting time stamps for weibull distribution

2013-11-04 Thread David Winsemius
On Nov 3, 2013, at 11:50 PM, kmmoon100 wrote: Hello everyone, I have been using bReeze package for weibull distribution analysis. In this package, there is a function called 'formatTS' for converting time stamps from string to POSIXlt.

[R] [R-pkgs] rmongodb 1.1.3 back to CRAN

2013-11-04 Thread Markus Schmidberger
Dear all, I am pleased to announce that the rmongodb package connecting R with the NoSQL database mongodb is back to CRAN: http://cran.r-project.org/web/packages/rmongodb/index.html This release is a bug fix release to get the package back to CRAN. I have overtaken the package maintenance from

Re: [R] add a color band

2013-11-04 Thread Alaios
Hi Jim Lemon, thanks for the help, I appreciate this. right now my code looks like. par(mar=c(5,4,4,5)) color2D.matplot(data,1,c(0,1),0,xlab=,ylab=Spans,   main=color.scale,xrange=c(-110,-50),border=NA,axes=F) color.legend(357,30,370,100,seq(-110,-50,length.out=13),  

[R] A warning message generated from 'read.csv'

2013-11-04 Thread Chia-Chieh Lin
Hi, I'm using R version 3.0.2. While I executed the following command filedata - read.csv(file, header=TRUE, colClasses=character) I got the warning message: In scan(file, what, nmax, sep, dec, quote, skip, nlines,  ... : EOF within quoted string I'd like to know what this means? And how

[R] Newbie Question: Repeatable Tasks

2013-11-04 Thread csvirtual
Hello mailing list, I am new to R using RStudio in Windows and I just want to have repeated tasks each day but could not find an answer to that reading a lot of intros, scrolling through even more and reading on S.O. I connect to a database, load data, do calculation, write results to the

[R] All curves with same y-axis scale

2013-11-04 Thread mohan . radhakrishnan
Hi, When I plot 3 curves with the same x-axis and same y-axis, the first two curves honor the y-axis but the last one doesn't. When I remove yaxt=n for the last curve a new scale appears on the y-axis along with the scales that the first two curves use. I want all curves to use the same y-axis

Re: [R] add a color band

2013-11-04 Thread Jim Lemon
On 11/04/2013 08:09 PM, Alaios wrote: Hi Jim Lemon, thanks for the help, I appreciate this. right now my code looks like. par(mar=c(5,4,4,5)) color2D.matplot(data,1,c(0,1),0,xlab=,ylab=Spans, main=color.scale,xrange=c(-110,-50),border=NA,axes=F)

Re: [R] Comparison of two weibull distributions

2013-11-04 Thread kmmoon100
Thank you so much for your explanation. I might be in a trouble again with processing log-likelihood analysis. If it happens, may I ask your instuctions next time? -- View this message in context: http://r.789695.n4.nabble.com/Comparison-of-two-weibull-distributions-tp4679632p4679680.html

Re: [R] All curves with same y-axis scale

2013-11-04 Thread Jim Lemon
On 11/04/2013 08:54 PM, mohan.radhakrish...@polarisft.com wrote: Hi, When I plot 3 curves with the same x-axis and same y-axis, the first two curves honor the y-axis but the last one doesn't. When I remove yaxt=n for the last curve a new scale appears on the y-axis along with the scales that

Re: [R] Inserting 17M entries into env took 18h, inserting 34M entries taking 5+ days

2013-11-04 Thread Magnus Thor Torfason
There are around 16M unique values. After accounting for equivalence, the number is much smaller (I don't know how much smaller, since my program has not completed yet :-) Yes, I meant that B and C are also equivalent. The original version was a typo. Best, Magnus On 11/1/2013 3:45 PM, jim

Re: [R] All curves with same y-axis scale

2013-11-04 Thread mohan . radhakrishnan
Hi, I changed the code. The first two curves seem to plot properly without the 'ylim'. 'ylim' doesn't allow the first two curves to plot properly. It doesn't have any effect on the 3rd curve.

Re: [R] A warning message generated from 'read.csv'

2013-11-04 Thread Carl Witthoft
Pretty much exactly what it says. Now, keep in mind that a warning message does not indicate a failure or error. Presumably you successfully read your file into filedata. What it's saying is that the EOL character exists inside some character string in one of the elements of your file.

Re: [R] Inserting 17M entries into env took 18h, inserting 34M entries taking 5+ days

2013-11-04 Thread Magnus Thor Torfason
On 11/1/2013 10:12 PM, Martin Morgan wrote: Do you mean that if A,B occur together and B,C occur together, then A,B and A,C are equivalent? Yes, that's what I meant, sorry, typo. I like your uid() function. It avoids the 20M times loop, and the issue of circular references can be solved by

Re: [R] Inserting 17M entries into env took 18h, inserting 34M entries taking 5+ days

2013-11-04 Thread Magnus Thor Torfason
Yes, I'm pretty familiar with igraph, but had not thought of using it for this. Interesting idea. So I presume I'd do something like (pseudocode): :Create igraph object from my data set as an edgelist :Create a list of connected subgraphs using clusters() :Loop through that list of clusters to

Re: [R] Newbie Question: Repeatable Tasks

2013-11-04 Thread John Kane
Just type the commands in the Source window of RStudioo, debug, save as a .r file and source it. I don't see any particular reason to have three scripts once everything is running correctly but you may find it useful. John Kane Kingston ON Canada -Original Message- From:

Re: [R] help with ggplot legend specification

2013-11-04 Thread John Kane
As a starting point perhaps have a look at legend.key.size (unit) in ?theme. It may do something like what you want with some tweaking. My quick and dirty example just applies the command to both legends. pl-ggplot(dat1,aes(x=Importance,y=Performance,fill=PBF,size=gapsize))+

[R] Reading data from Excel file in r

2013-11-04 Thread Baro
Hi experts, I want to read data from an excel data like this: for the fifth column, from first row until 140 but only 1,3,5,7,.139 (only 70 values), How can I do it in R? thanks [[alternative HTML version deleted]] __

Re: [R] Subject: Regress multiple independent variables on multiple dependent variables

2013-11-04 Thread Michael Friendly
It's not clear exactly what you mean by 'automate' but you can simplify a bit by fitting a multivariate linear model to all the responses together, and using . on the RHS of the formula to represent all other variables in the data set as independent variables, m.all - glm(cbind(O3, temp) ~ .,

Re: [R] Download CSV Files from EUROSTAT Website

2013-11-04 Thread Adams, Jean
Lorenzo, You might want to post this is a new question to get some new eyes on it. Or, you could try posting your question to http://stackoverflow.com/. Scraping the web is a common topic for that group. Jean On Mon, Nov 4, 2013 at 3:53 AM, Lorenzo Isella lorenzo.ise...@gmail.comwrote:

Re: [R] Reading data from Excel file in r

2013-11-04 Thread jim holtman
Take a look at the XLConnect package. I use it for all the reading/writing for Excel files. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Mon, Nov 4, 2013 at 8:47 AM, Baro babak...@gmail.com wrote: Hi

[R] How to plot results of clmm()?

2013-11-04 Thread thomas
Dear list, I'd like to create a visual plot of a clmm() I've fitted using the 'ordinal' package in R. It's possible to do this with a glm() by using the 'effects' package. For example: library(effects) data(BEPS) mod - lm(political.knowledge ~ age + gender + vote, data=BEPS) eff

Re: [R] Reading data from Excel file in r

2013-11-04 Thread Adams, Jean
You can use the XLConnect package to read in a range of rows and columns, then define a function to subset the odd rows. For example, library(XLConnect) wb - loadWorkbook(C:/temp/MyData.xls) dat - readWorksheet(wb, sheet=getSheets(wb)[1], startRow=1, endRow=139, startCol=5, endCol=5) dat -

Re: [R] help with ggplot legend specification

2013-11-04 Thread Ista Zahn
Hi John, On Mon, Nov 4, 2013 at 8:25 AM, John Kane jrkrid...@inbox.com wrote: As a starting point perhaps have a look at legend.key.size (unit) in ?theme. That will change the size of the legend key, not the size of the aesthetics inside the legend. For that you need to use override.aes in

Re: [R] add a color band

2013-11-04 Thread Alaios
Hi Jim, thanks for the answer! I toyed around as you said and now they look cool and sexy! many thanks! Do you know if there is a way to compress a bit the output? The image type of functions have the useRaster parameter to set to have a compressed output. Right now the produced plots are

Re: [R] Reading data from Excel file in r

2013-11-04 Thread Baro
thanks alot, but now I have another problem: my Excel file is very big and I get this error, which says: Error: OutOfMemoryError (Java): Java heap space Is there any way to read each value one by one and save them in an array? On Mon, Nov 4, 2013 at 6:13 AM, Adams, Jean jvad...@usgs.gov wrote:

Re: [R] Newbie Question: Repeatable Tasks

2013-11-04 Thread csvirtual
Thanks John, It works. (just saved source and clicked Source to run it, without debug(?)). Best Chris -Ursprüngliche Nachricht- Von: John Kane [mailto:jrkrid...@inbox.com] Gesendet: Montag, 4. November 2013 14:09 An: csvirt...@gmx.de; r-help@r-project.org Betreff: RE: [R] Newbie

Re: [R] Reading data from Excel file in r

2013-11-04 Thread Adams, Jean
Perhaps the discussion at this link will help ... (see especially the second answer). http://stackoverflow.com/questions/7963393/out-of-memory-error-java-when-using-r-and-xlconnect-package Jean On Mon, Nov 4, 2013 at 8:26 AM, Baro babak...@gmail.com wrote: thanks alot, but now I have

Re: [R] Reading data from Excel file in r

2013-11-04 Thread Baro
thanks, I changed my code, but still have the same problem :/ On Mon, Nov 4, 2013 at 6:49 AM, Adams, Jean jvad...@usgs.gov wrote: Perhaps the discussion at this link will help ... (see especially the second answer).

Re: [R] Download CSV Files from EUROSTAT Website

2013-11-04 Thread Lorenzo Isella
Hello, And thanks a lot. This is indeed very close to what I need. I am trying to figure out how not to lose the headers and how to avoid downloading labels like (p) together with the numerical data I am interested in. If anyone on the list knows how to make this minor modifications, s/he

[R] Save P values calculated with anova

2013-11-04 Thread Anders Tisell
Hi, I have created a mixed linear model with one fixed factor and two random factors then I would like to test if there is a significant difference between the two groups. To do this I calculate the model with the lmer function: MyModel - lmer(...) and do a anova of the model to estimate if

Re: [R] Subject: Regress multiple independent variables on multiple dependent variables

2013-11-04 Thread arun
Hi, This gives an error.  glm(cbind(O3, temp) ~ ., data=ozone) Error in x[good, , drop = FALSE] : (subscript) logical subscript too long  lm(cbind(O3, temp) ~ ., data=ozone) #works R version 3.0.2 (2013-09-25) Platform: x86_64-unknown-linux-gnu (64-bit) locale:  [1] LC_CTYPE=en_CA.UTF-8   

[R] Error message in SPACECAP package

2013-11-04 Thread Miroslav Kutal
Dear all I've tried a spatial capture-recapture in SPACECAP package but got stuck after uploading the input data files: Error in animal capture details file - non-integer or missing values Error in if (locso[loc, so + 3] == 0) { : missing value where TRUE/FALSE needed I prepared the input

Re: [R] Replace element with pattern

2013-11-04 Thread arun
Hi, Using ?gsub() gsub([^0-9]+, ,a$Col1) #or  gsub([^0-9]+(,|/|), ,a$Col1) library(stringr) dat - read.table(text=str_trim(gsub([^0-9]+(,|/|), ,a$Col1)),sep=) A.K. On Monday, November 4, 2013 2:22 AM, mohan.radhakrish...@polarisft.com mohan.radhakrish...@polarisft.com wrote: Please

Re: [R] Save P values calculated with anova

2013-11-04 Thread ONKELINX, Thierry
You'll need to add quotes MyAnova$Pr(F) Or use the bracket notation MyAnova[, Pr(F)] ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht

Re: [R] forecast.lm() and NEWDATA

2013-11-04 Thread Ryan
Hi David (and everyone) Thank you for your reply. I see I copied down the code wrong for the regression. I was using the + seperator, and not ,. The regression was working. I made a mistake with the NEWDATA, where I also used +, instead of ,, however I see both work but return very

Re: [R] Save P values calculated with anova

2013-11-04 Thread Adrian Dușa
That would be: MyAnova$Pr(F) and since that is an Anova table, you actually only need the first value: MyAnova$Pr(F)[1] Hope this helps, Adrian On Mon, Nov 4, 2013 at 4:10 PM, Anders Tisell anders.tis...@liu.se wrote: Hi, I have created a mixed linear model with one fixed factor and two

Re: [R] Download CSV Files from EUROSTAT Website

2013-11-04 Thread Carlos Ortega
Hi Lorenzo, Perhaps package pxR can help you out. http://cran.at.r-project.org/web/packages/pxR/index.html pxR: PC-Axis with R The pxR package provides a set of functions for reading and writing PC-Axis files, used by different statistical organizations around the globe for data dissemination.

Re: [R] Reading data from Excel file in r

2013-11-04 Thread Jim Holtman
Is this an .xlsx file format?  If so convert to .xls and try again.   .xlsx is compressed and takes a lot more resources in XLConnect Sent from my Verizon Wireless 4G LTE Smartphone Original message From: Baro babak...@gmail.com Date: 11/04/2013 09:26 (GMT-05:00) To:

Re: [R] Reading data from Excel file in r

2013-11-04 Thread Baro
thanks Jim, I have tried it but still the same error :/ On Mon, Nov 4, 2013 at 7:34 AM, Jim Holtman jholt...@gmail.com wrote: Is this an .xlsx file format? If so convert to .xls and try again. .xlsx is compressed and takes a lot more resources in XLConnect Sent from my Verizon Wireless 4G

Re: [R] Newbie Question: Repeatable Tasks

2013-11-04 Thread Patrick Burns
Breaking up the task is an excellent way of thinking. John's solution is probably simplest in the short run but not necessarily best in the long run. How I'd do it is write a function for each of your three tasks and then have a script to call the functions. There would be two source files:

Re: [R] Subject: Regress multiple independent variables on multiple dependent variables

2013-11-04 Thread Michael Friendly
On 11/4/2013 9:18 AM, arun wrote: Hi, This gives an error. glm(cbind(O3, temp) ~ ., data=ozone) Error in x[good, , drop = FALSE] : (subscript) logical subscript too long lm(cbind(O3, temp) ~ ., data=ozone) #works Right. With no family= specified, lm() is equivalent to what I meant. If

[R] variable standardization in manova() call

2013-11-04 Thread Sergio Fonda
Hi, I'm not able to get information about the following question: is the variables standardization a default option in manova() (stats package)? Or if you want to compare variables with different units or scales and rather different variances, you have to previously standardize the variables ?

[R] Fwd: mediation analysis with R

2013-11-04 Thread Stefania Orini
MEDIATION ANALYSIS WITH R I have tried to do a mediation analysis In my dataset I did not use a treatment. If i write treatment = NULL the program sends me back a error. How i can do this? R model.m - lm(job_seek ~ treat + depress1 + econ_hard + sex + age + occp + marital + nonwhite + educ +

[R] Strange results using match and which function

2013-11-04 Thread Timo Schmid
Hello, I want to match specific numbers and a vector. Therefore I use the match or which function but I get unreasonable results. Has anybody an idea why I got a NA inmatch(0.12, tau)Please see the code below: tau-seq(0.02,0.98,0.02) tau [1] 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20

Re: [R] Strange results using match and which function

2013-11-04 Thread Bert Gunter
R FAQ 7.31 . -- Bert On Mon, Nov 4, 2013 at 10:29 AM, Timo Schmid timo_sch...@hotmail.com wrote: Hello, I want to match specific numbers and a vector. Therefore I use the match or which function but I get unreasonable results. Has anybody an idea why I got a NA inmatch(0.12, tau)Please see

[R] alternative for shell() in Mac

2013-11-04 Thread Nicolas Gutierrez
Hi All, I'm trying to run an ADMB function on R for Mac and need to find a substitute for the Windows command shell(). I tried system() but I get the following message: system(ADMBFile) /bin/sh: /Users/nicolas/Desktop/SPE/LBSPR_ADMB/L_AFun.exe: cannot execute binary file Any hints please?

Re: [R] alternative for shell() in Mac

2013-11-04 Thread David Winsemius
On Nov 4, 2013, at 9:52 AM, Nicolas Gutierrez wrote: Hi All, I'm trying to run an ADMB function on R for Mac and need to find a substitute for the Windows command shell(). I tried system() but I get the following message: system(ADMBFile) /bin/sh:

Re: [R] Strange results using match and which function

2013-11-04 Thread Sarah Goslee
This looks like R FAQ 7.31, the one so commonly asked that regulars on this list have its number memorized! tau-seq(0.02,0.98,0.02) match(round(0.12, 2), round(tau, 2)) [1] 6 match(round(0.16, 2), round(tau, 2)) [1] 8 See also ?all.equal Sarah On Mon, Nov 4, 2013 at 1:29 PM, Timo Schmid

Re: [R] Download CSV Files from EUROSTAT Website

2013-11-04 Thread Rui Barradas
Hello, If you want to get rid of the (bp) stuff, you can use lapply/gsub. Using Jean's code a bit changed, library(XML) mylines - readLines(url(http://bit.ly/1coCohq;)) closeAllConnections() mytable - readHTMLTable(mylines, which = 2, asText=TRUE, stringsAsFactors = FALSE) str(mytable)

Re: [R] alternative for shell() in Mac

2013-11-04 Thread Marc Schwartz
On Nov 4, 2013, at 11:52 AM, Nicolas Gutierrez nicolas.gutier...@msc.org wrote: Hi All, I'm trying to run an ADMB function on R for Mac and need to find a substitute for the Windows command shell(). I tried system() but I get the following message: system(ADMBFile) /bin/sh:

Re: [R] Download CSV Files from EUROSTAT Website

2013-11-04 Thread Lorenzo Isella
Thanks. I had already introduced this minor adjustments in the code, but the real problem (to me) is the information that gets lost: the informative name of the columns, the indicator type and the units. Cheers Lorenzo On Mon, 04 Nov 2013 19:52:51 +0100, Rui Barradas ruipbarra...@sapo.pt

Re: [R] Download CSV Files from EUROSTAT Website

2013-11-04 Thread David Winsemius
On Nov 4, 2013, at 11:03 AM, Lorenzo Isella wrote: Thanks. I had already introduced this minor adjustments in the code, but the real problem (to me) is the information that gets lost: the informative name of the columns, the indicator type and the units. Maybe you should use their

[R] transform one probability distribution into another

2013-11-04 Thread b. alzahrani
Hi guys Given a exponential curve, is there any function on r that can generate exponential distributed random numbers? in General I want an function that can transform one probability distribution into another?? Regards **

Re: [R] transform one probability distribution into another

2013-11-04 Thread Rui Barradas
Hello, At an R prompt type ?rexp Also, read An Introduction to R, file R-intro.pdf that comes with your distribution of R, namely, chapter 8 Probability distributions. Hope this helps, Rui Barradas Em 04-11-2013 19:14, b. alzahrani escreveu: Hi guys Given a exponential curve, is there

Re: [R] Inserting 17M entries into env took 18h, inserting 34M entries taking 5+ days

2013-11-04 Thread Thomas Lumley
On Sat, Nov 2, 2013 at 11:12 AM, Martin Morgan mtmor...@fhcrc.org wrote: On 11/01/2013 08:22 AM, Magnus Thor Torfason wrote: Sure, I was attempting to be concise and boiling it down to what I saw as the root issue, but you are right, I could have taken it a step further. So here goes. I

Re: [R] transform one probability distribution into another

2013-11-04 Thread Greg Snow
As a general rule, the distribution functions that start with p (e.g. pnorm, pexp, pgamma, ...) will transform a random variable from the corresponding distribution to a uniformly distributed random variable. The functions that start with q (e.g. qnorm, qexp, qgamma, ...) will transform a uniform

Re: [R] Download CSV Files from EUROSTAT Website

2013-11-04 Thread Lorenzo Isella
On Mon, 04 Nov 2013 20:26:46 +0100, David Winsemius dwinsem...@comcast.net wrote: On Nov 4, 2013, at 11:03 AM, Lorenzo Isella wrote: Thanks. I had already introduced this minor adjustments in the code, but the real problem (to me) is the information that gets lost: the informative name

[R] Can I obtain baseline hazard estimates in the gamma frailty model by using coxph()?

2013-11-04 Thread Y
Hello, Does anyone know how to obtain nonparametric baseline hazard estimates in the gamma frailty model by using coxph()? I can easily get the other parameter estimates by using coxph() but don't know how to get the baseline hazard estimates from it. Thanks, YH [[alternative HTML

Re: [R] R loop for applying an equation to each unique category

2013-11-04 Thread arun
Hi,You could use: dat1 - structure(list(Haplotype = c(H1, H1, H1, H2, H2, H2, H3, H3, H3, H4, H4, H4, H4, H4, H4), Frequency = c(0.8278, 0.02248, 0.1494, 0.8238, 0.02248, 0.1497, 0.1497, 0.02248, 0.8244, 0.628, 0.02248, 0.1483, 0.1637, 0.01081, 0.01798)), .Names = c(Haplotype, Frequency),

Re: [R] How to obtain nonparametric baseline hazard estimates in the gamma frailty model?

2013-11-04 Thread Terry Therneau
On 11/03/2013 05:00 AM, r-help-requ...@r-project.org wrote: I can easily get the other parameter estimates by using coxph() but don't know how to get the baseline hazard estimates from it. Does anyone know how to obtain nonparametric baseline hazard estimates in the gamma frailty model?

Re: [R] How to obtain nonparametric baseline hazard estimates in the gamma frailty model?

2013-11-04 Thread Y
Hi Dr. Therneau, Thanks very much for your kind help! Does survfit() just give me the survival curve? What I wanted is the baseline hazard estimates, i.e., lambda_{0} (t). How can I obtain this estimate from coxph()? Or using basehaz()? Thanks, YH On Mon, Nov 4, 2013 at 5:29 PM, Terry

[R] Fwd: Re: How to obtain nonparametric baseline hazard estimates in the gamma frailty model?

2013-11-04 Thread Terry Therneau
Original Message Subject: Re: How to obtain nonparametric baseline hazard estimates in the gamma frailty model? Date: Mon, 04 Nov 2013 17:27:04 -0600 From: Terry Therneau therneau.te...@mayo.edu To: Y yuhan...@gmail.com The cumulative hazard is just -log(sfit$surv). The

Re: [R] How to obtain nonparametric baseline hazard estimates in the gamma frailty model?

2013-11-04 Thread Y
Hi Dr. Therneau, Yes, -log(sfit$surv) gives me the cumulative hazard but not the baseline cumulative hazard. I know that Nielsen and Klein have SAS Macros to get such estimates by using EM approach. I'm wondering if I can obtain the baseline hazard estimates from coxph() for gamma frailty model

[R] speed issue: gsub on large data frame

2013-11-04 Thread Simon Pickert
Hi R’lers, I’m running into speeding issues, performing a bunch of „gsub(patternvector, [token],dataframe$text_column) on a data frame containing 4millionentries. (The “patternvectors“ contain up to 500 elements) Is there any better/faster way than performing like 20 gsub commands in a row?

Re: [R] speed issue: gsub on large data frame

2013-11-04 Thread Jeff Newmiller
Example not reproducible. Communication fail. Please refer to Posting Guide. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live