Re: [R] function recode within sapply

2011-10-02 Thread Joshua Wiley
Hi Lara, Use lapply here instead of sapply or specify simplify = FALSE. See ?sapply for details. d[, c("fac1", "fac2")] <- lapply(d[, c("fac1", "fac2")], recode, "c('A', 'B') = 'XX'", as.factor.result = TRUE) d[, "fac3"] <- recode(d[, "fac3"], "c('A', 'B') = 'XX'") str(d) Cheers, Josh On Sun,

Re: [R] How to format R superscript 2 followed by "=" value

2011-10-02 Thread Joshua Wiley
Hi Nevil, Here is one option: ## function definition r2format <- function(object, digits = 3, output, sub, expression = TRUE, ...) { if (inherits(object, "lm")) { x <- summary(object) } else if (inherits(object, "summary.lm")) { x <- object } else s

[R] function recode within sapply

2011-10-02 Thread Lara Poplarski
Dear List, I am using function recode, from package car, within sapply, as follows: L3 <- LETTERS[1:3] (d <- data.frame(cbind(x = 1, y = 1:10), fac1 = sample(L3, 10, replace=TRUE), fac2 = sample(L3, 10, replace=TRUE), fac3 = sample(L3, 10, replace=TRUE))) str(d) d[, c("fac1", "fac2")] <- sapply(

[R] How to format R superscript 2 followed by "=" value

2011-10-02 Thread Nevil Amos
I am trying to put an R2 value with R2 formatted with a superscript 2 followed by "=" and the value : the first mtext prints the R2 correctly formatted but follows it with "=round(summary(mylm)$r.squared,3)))" as text the second prints "R^2 =" followed by the value of round(summary(mylm)$r.squ

Re: [R] patients.txt data

2011-10-02 Thread Steve Lianoglou
Hi, On Sun, Oct 2, 2011 at 4:31 PM, Melhem, Nadine wrote: > I'm new to learning R. I'm taking a course and will need access to the > "patients.txt" data to be able to do the exercises required using this > dataset. Without more context, I'm doubtful that anybody will be able to help you. I re

[R] rolling regression

2011-10-02 Thread Darius H
Dear all, I have spent the last few days on a seemingly simple and previously documented rolling regression. I have a 60 year data set organized in a ts matrix. The matrix has 5 columns; cash_ret, epy1, ism1, spread1, unemp1 I have been able to come up with the following based on previous hel

Re: [R] Scatterplot with the 3rd dimension = color?

2011-10-02 Thread Ben Bolker
Duncan Murdoch gmail.com> writes: > > On 11-10-02 1:11 PM, Kerry wrote: > > I have 3 columns of data and want to plot each row as a point in a > > scatter plot and want one column to be represented as a color gradient > > (e.g. larger values being more red). Anyone know the command or > > packa

[R] patients.txt data

2011-10-02 Thread Melhem, Nadine
I'm new to learning R. I'm taking a course and will need access to the "patients.txt" data to be able to do the exercises required using this dataset. thanks. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do re

[R] patients.txt data

2011-10-02 Thread Nadine Melhem
please send me the "patients.txt" data. thanks. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-containe

Re: [R] Scatterplot with the 3rd dimension = color?

2011-10-02 Thread Kerry
Yes, perfect! This I can work with. Thanks, KB On Oct 2, 3:55 pm, Duncan Murdoch wrote: > On 11-10-02 1:11 PM, Kerry wrote: > > > I have 3 columns of data and want to plot each row as a point in a > > scatter plot and want one column to be represented as a color gradient > > (e.g. larger  values

[R] about the array transpose

2011-10-02 Thread venerealdisease
Hi, all, I am a newbie for [R] Would anyone help me how to transpose a 3x3x3 array for 1:27 Eg. A<-array(1:27, c(3,3,3) What is the logic to transpose it to B<-aperm(A, c(3,2,1)) Because I found I could not imagine how it transposes, anyone could solve my problem? And most important I could get

Re: [R] Is the output of survfit.coxph survival or baseline survival?

2011-10-02 Thread Terry Therneau
> Dear all, > I am confused with the output of survfit.coxph. > Someone said that the survival given by summary(survfit.coxph) is the > baseline survival S_0, but some said that is the survival > S=S_0^exp{beta*x}. > > Which one is correct? The ³baseline survival², which is the survival for a hyp

Re: [R] difference between createPartition and createfold functions

2011-10-02 Thread Max Kuhn
Basically, createDataPartition is used when you need to make one or more simple two-way splits of your data. For example, if you want to make a training and test set and keep your classes balanced, this is what you could use. It can also make multiple splits of this kind (or leave-group-out CV aka

Re: [R] Find all duplicate records

2011-10-02 Thread Gabor Grothendieck
On Sun, Oct 2, 2011 at 10:05 AM, Erik Svensson wrote: > Hello, > In a data frame I want to identify ALL duplicate IDs in the example to be > able to examine "OS" and "time". > > (df<-data.frame(ID=c("userA", "userB", "userA", "userC"), >  OS=c("Win","OSX","Win", "Win64"), >  time=c("12:22","23:22"

Re: [R] Keep ALL duplicate records

2011-10-02 Thread jim holtman
Here is a function I use to find all duplicate records > allDup <- function (value) { duplicated(value) | duplicated(value, fromLast = TRUE) } > x IDOS time 1 userA Win 12:22 2 userB OSX 23:22 3 userA Win 04:44 4 userC Win64 12:28 > x[allDup(x$ID),] ID OS time 1 userA Wi

Re: [R] error while using shapiro.test()

2011-10-02 Thread csrabak
Em 1/10/2011 13:24, spicymchaggis101 escreveu: Thank you very much! your response solved my issue. I needed to determine the probability of normality for word types per page. You need to insure this assumption is reasonable for your problem domain as words types per page seems like count data

Re: [R] difference between createPartition and createfold functions

2011-10-02 Thread Steve Lianoglou
Hi, On Sun, Oct 2, 2011 at 3:54 PM, wrote: > Hi Steve, > > Thanks for the note. I did try the example and the result didn't make sense > to me. For splitting a vector, what you describe is a big difference btw > them. For splitting a dataframe, I now wonder if these 2 functions are the > wrong c

Re: [R] R Studio and Rcmdr/RcmdrPlugins

2011-10-02 Thread Tal Galili
Hi Erin, The last I checked - it was not possible. However, the place to ask this is here: http://support.rstudio.org/help/discussions Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.

Re: [R] Scatterplot with the 3rd dimension = color?

2011-10-02 Thread Duncan Murdoch
On 11-10-02 1:11 PM, Kerry wrote: I have 3 columns of data and want to plot each row as a point in a scatter plot and want one column to be represented as a color gradient (e.g. larger values being more red). Anyone know the command or package for this? It's not a particularly effective displa

Re: [R] difference between createPartition and createfold functions

2011-10-02 Thread bby2103
Hi Steve, Thanks for the note. I did try the example and the result didn't make sense to me. For splitting a vector, what you describe is a big difference btw them. For splitting a dataframe, I now wonder if these 2 functions are the wrong choices. They seem to split the columns, at least

Re: [R] Scatterplot with the 3rd dimension = color?

2011-10-02 Thread Tal Galili
Here is one: http://cran.r-project.org/web/packages/scatterplot3d/index.html In the future, consider first searching: http://finzi.psych.upenn.edu/search.html http://rseek.org/ etc... Contact Details:--- Contact me: tal.gal...

Re: [R] is member

2011-10-02 Thread Alaios
Dear all, I would like to thank you for you answers This worked for me Browse[1]> match(Test,seq(1,C,FrN),nomatch=FALSE)   [1]   1   0   2   3   0   0   4   0   0   5   0   0   6   7   0   0   8   0  [19]   0   9   0  10  11   0   0  12   0   0  13  14   0  15   0  16   0   0  [37]  17  18  19   0

[R] Scatterplot with the 3rd dimension = color?

2011-10-02 Thread Kerry
I have 3 columns of data and want to plot each row as a point in a scatter plot and want one column to be represented as a color gradient (e.g. larger values being more red). Anyone know the command or package for this? Thanks, KB __ R-help@r-project.o

Re: [R] difference between createPartition and createfold functions

2011-10-02 Thread Steve Lianoglou
Hi, On Sun, Oct 2, 2011 at 2:47 PM, wrote: > Hello, > > I'm trying to separate my dataset into 4 parts with the 4th one as the test > dataset, and the other three to fit a model. > > I've been searching for the difference between these 2 functions in Caret > package, but the most I can get is th

Re: [R] Advice on approach to weighting survey

2011-10-02 Thread Thomas Lumley
On Sat, Oct 1, 2011 at 4:59 AM, Farley, Robert wrote: > I'm about to add weights to a bus on-board survey dataset with ~150 variables > and ~28,000 records.  My intention is to weight (for each bus "run") by > boarding stop and alighting stop.  I've seen the Rake function of the Survey > packag

Re: [R] Is the output of survfit.coxph survival or baseline survival?

2011-10-02 Thread Thomas Lumley
On Sat, Oct 1, 2011 at 2:31 PM, koshihaku wrote: > Dear all, > I am confused with the output of survfit.coxph. > Someone said that the survival given by summary(survfit.coxph) is the > baseline survival S_0, but some said that is the survival S=S_0^exp{beta*x}. > > Which one is correct? The basel

[R] difference between createPartition and createfold functions

2011-10-02 Thread bby2103
Hello, I'm trying to separate my dataset into 4 parts with the 4th one as the test dataset, and the other three to fit a model. I've been searching for the difference between these 2 functions in Caret package, but the most I can get is this-- A series of test/training partitions are crea

Re: [R] Keep ALL duplicate records

2011-10-02 Thread Pete Brecknock
Erik Svensson wrote: > > Hello, > In a data frame I want to identify ALL duplicate IDs in the example to be > able to examine "OS" and "time". > > (df<-data.frame(ID=c("userA", "userB", "userA", "userC"), > OS=c("Win","OSX","Win", "Win64"), > time=c("12:22","23:22","04:44","12:28"))) > >

Re: [R] On-line machine learning packages?

2011-10-02 Thread Steve Lianoglou
Hi Jay, I see this thread is a bit (ok, quite) old at this point, but I see you never really got an answer to your question that was satisfactory. I figured you might be interested to know that Dirk has started to wrap vowpal wabbit[1,2] into an R package, RVowpalWabbit[3,4] The package itself is

Re: [R] On-line machine learning packages?

2011-10-02 Thread Jason Edgecombe
Hello Jay, Did you find the answer to your question on incremental machine learning? If not, I found some links that might help: It appears that might be able to do streaming/incremental machine learning in Weka: http://moa.cs.waikato.ac.nz/details/classification/using-weka/ On the above li

Re: [R] error while using shapiro.test()

2011-10-02 Thread Peter Ehlers
On 2011-10-01 09:24, spicymchaggis101 wrote: Thank you very much! your response solved my issue. I needed to determine the probability of normality for word types per page. You may want to review just what the test does. It certainly does not give you the 'probability of normality'. A worthwh

[R] regarding specifying criteria for Cointegration

2011-10-02 Thread upananda pani
Dear All, I am learning R and Time Series Econometrics for the first time. I have doubt regarding cointegration specification criteria. The problem follows: test1 <- ca.jo(data1,ecdet="const",type="trace",K=2,spec="transitory")---When to specify transitory test1 <- ca.jo(data1,ecdet="const",type=

[R] generating Venn diagram with 6 sets

2011-10-02 Thread Mao Jianfeng
Dear r-helpers, Here I would like to have your kind helps on generating Venn diagram. There are some packages within R on this task, like venneuler, VennDiagram, vennerable. But, vennerable can not be installed on my Mac book. It seems VennDiagram can not work on my data. And, venneuler may have

Re: [R] Poor performance of "Optim"

2011-10-02 Thread Ravi Varadhan
Hi, You really need to study the documentation of "optim" carefully before you make broad generalizations. There are several algorithms available in optim. The default is a simplex-type algorithm called Nelder-Mead. I think this is an unfortunate choice as the default algorithm. Nelder-Mea

Re: [R] Find all duplicate records

2011-10-02 Thread Uwe Ligges
On 02.10.2011 16:05, Erik Svensson wrote: Hello, In a data frame I want to identify ALL duplicate IDs in the example to be able to examine "OS" and "time". (df<-data.frame(ID=c("userA", "userB", "userA", "userC"), OS=c("Win","OSX","Win", "Win64"), time=c("12:22","23:22","04:44","12:28"))

[R] Find all duplicate records

2011-10-02 Thread Erik Svensson
Hello, In a data frame I want to identify ALL duplicate IDs in the example to be able to examine "OS" and "time". (df<-data.frame(ID=c("userA", "userB", "userA", "userC"), OS=c("Win","OSX","Win", "Win64"), time=c("12:22","23:22","04:44","12:28"))) IDOS time 1 userA Win 12:22 2 use

[R] Arimax First-Order Transfer Function

2011-10-02 Thread David Humphreys
Dear list members, I am a (very) recent convert to R and I am hoping you can help me with a problem I'm having. I'm trying to fit a first-order transfer function to an ARIMA intervention analysis using the "arimax" function. The data was obtained from McCleary & Hay (1980) (via Rob Hyndman's Time

Re: [R] Overlapping plot in lattice

2011-10-02 Thread Kang Min
Thanks Gabor, that was exactly what I needed. On Sep 30, 9:00 pm, Gabor Grothendieck wrote: > On Fri, Sep 30, 2011 at 3:01 AM, Kang Min wrote: > > Hi all, > > > I was wondering if there's an equivalent to par(new=T) of the plot > > function in lattice. I'm plotting an xyplot, and I would like to

Re: [R] subset in dataframes

2011-10-02 Thread Cecilia Carmo
Sarah, Sorry for being ignorant. I was doing something wrong. It works perfectly. Thank you. Cecília Carmo -Mensagem original- De: Sarah Goslee [mailto:sarah.gos...@gmail.com] Enviada: domingo, 2 de Outubro de 2011 14:21 Para: Cecilia Carmo Cc: r-help@r-project.org Assunto: Re: [R] s

Re: [R] subset in dataframes

2011-10-02 Thread Sarah Goslee
Hi, On Sun, Oct 2, 2011 at 9:08 AM, Cecilia Carmo wrote: > Thank you very much. > > My dataframe has thousands of firms, how can I delete all of those with x<0 > and keep another dataframe with firms where all x>0? How does that differ from your original question? What doesn't work for you in th

Re: [R] subset in dataframes

2011-10-02 Thread Cecilia Carmo
Thank you very much. My dataframe has thousands of firms, how can I delete all of those with x<0 and keep another dataframe with firms where all x>0? Thank you again. Cecília Carmo (Universidade de Aveiro - Portugal) -Mensagem original- De: Sarah Goslee [mailto:sarah.gos...@gmail.com]

Re: [R] Fitting 3 beta distributions

2011-10-02 Thread Achim Zeileis
On Sat, 1 Oct 2011, Nitin Bhardwaj wrote: Hi, I want to fit 3 beta distributions to my data which ranges between 0 and 1. What are the functions that I can easily call and specify that 3 beta distributions should be fitted? I have already looked at normalmixEM and fitdistr but they dont seem to

[R] Difference between ~lp() or simply ~ in R's locfit?

2011-10-02 Thread László Sándor
As I think it is not spam but helpful, let me repeat my stats.stackexchange.com question here, from http://stats.stackexchange.com/questions/16346/difference-between-lp-or-simply-in-rs-locfit I am not sure I see the difference between different examples for local logistic regression in the docu

Re: [R] subset in dataframes

2011-10-02 Thread Sarah Goslee
Hi, On Sun, Oct 2, 2011 at 7:48 AM, Cecilia Carmo wrote: > I need help in subseting a dataframe: > > > > data1<-data.frame(year=c(2001,2002,2003,2004,2001,2002,2003,2004, > > 2001,2002,2003,2004,2001,2002,2003,2004), > > firm=c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4),x=c(11,22,-32,25,-26,47,85,98, > > 1

[R] subset in dataframes

2011-10-02 Thread Cecilia Carmo
I need help in subseting a dataframe: data1<-data.frame(year=c(2001,2002,2003,2004,2001,2002,2003,2004, 2001,2002,2003,2004,2001,2002,2003,2004), firm=c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4),x=c(11,22,-32,25,-26,47,85,98, 101,14,87,56,12,43,67,54), y=c(110,220,302,250,260,470,850,980,1010,140,87

Re: [R] Ipad on R

2011-10-02 Thread Sarah Goslee
2011/10/2 Oscar Ramírez : > It is possible to install R on Ipad 2? > This discussion predates the iPad 2, but the licensing restrictions likely still apply: http://www.r-statistics.com/2010/06/could-we-run-a-statistical-analysis-on-iphoneipad-using-r/ One-word answer: no. Two-word answer: Not lega

Re: [R] plot: how to fix the ratio of the plot box?

2011-10-02 Thread Hofert Jan Marius
ahh, perfect, thanks. Cheers, Marius On 2011-10-02, at 13:08 , Jim Lemon wrote: > On 10/02/2011 07:20 PM, Hofert Jan Marius wrote: >> Dear all, >> >> this should be trivial, but I couldn't figure out how to solve it... I would >> like to have a plot with fixed aspect ratio of 1. Whenever I re

Re: [R] plot: how to fix the ratio of the plot box?

2011-10-02 Thread Jim Lemon
On 10/02/2011 07:20 PM, Hofert Jan Marius wrote: Dear all, this should be trivial, but I couldn't figure out how to solve it... I would like to have a plot with fixed aspect ratio of 1. Whenever I resize the Quartz window, the axes are extended so that the plot fills the whole window. However,

[R] Ipad on R

2011-10-02 Thread Oscar Ramírez
It is possible to install R on Ipad 2? -- Oscar Ramírez A. Universidad Nacional, Escuela de Ciencias Biológicas. M.Sc. en Conservación y Manejo de Vida Silvestre osorami...@gmail.com [[alternative HTML version deleted]] __ R-help@r-p

Re: [R] Poor performance of "Optim"

2011-10-02 Thread Daniel Malter
And there I caught myself with the next blooper: it wasn't Ben Bolker, it was Bert Gunter who pointed that out. :) Daniel Malter wrote: > > Ben Bolker sent me a private email rightfully correcting me that was > factually wrong when I wrote that ML /is/ a numerical method (I had > written sloppil

Re: [R] Poor performance of "Optim"

2011-10-02 Thread Daniel Malter
Ben Bolker sent me a private email rightfully correcting me that was factually wrong when I wrote that ML /is/ a numerical method (I had written sloppily and under time pressure). He is of course right to point out that not all maximum likelihood estimators require numerical methods to solve. Furth

[R] plot: how to fix the ratio of the plot box?

2011-10-02 Thread Hofert Jan Marius
Dear all, this should be trivial, but I couldn't figure out how to solve it... I would like to have a plot with fixed aspect ratio of 1. Whenever I resize the Quartz window, the axes are extended so that the plot fills the whole window. However, if you have different extensions for the differen