Re: [R] Package for Neural Network Classification Quality

2011-09-27 Thread Claudia Beleites
Alejandro, Hi, somebody knows about one R-package which i can evaluate quality (recall, precision, accuracy, etc) of Neural network classification with more than 2 classes. I found ROCT package, http://cran.r-project.org/web/packages/ROCR/index.html, but it only workes with binary classification

Re: [R] two-way anova help

2011-09-27 Thread Austin Paul
Hi Indrajit and Bert, I really appeciate your help. I have coded as you mentioned, but I feel like I am losing a lot of data because I am not accounting for the replicate tanks (what if the 5 replicates of the same cross type vary more among tanks than within?). Below is what my data would look

Re: [R] How to terminate R program if found any execution error

2011-09-27 Thread Allan Engelhardt
The original poster may also be interested in options("error") to capture the 'any execution error' requirement. From the examples in help("options"): ## Not run: ## on error, terminate the R session with error status 66 options(error = quote(q("no", status=66, runLast=FALSE))) stop("test it")

Re: [R] Does replacing some values of a zoo object by NA reduce it's size ?

2011-09-27 Thread Allan Engelhardt
It is not an anomaly. The object is the same size (object.size(f1)==object.size(f2)); its file representation is different. On 27/09/2011 07:00, Ashim Kapoor wrote: Dear R-helpers, Please have a look at the following. f1 is the same as f2 except that it has some values replaced by NA. But it'

[R] regression with ordered arguments

2011-09-27 Thread Francesco Sarracino
Dear R listers, I am trying to be a new R user, but life is not that easy. My problem is the following one: let's assume to have 3 outcome variables (y1, y2, y3) and 3 explanatory ones (x1, x2, x3). How can I run the following three separate regressions without having to repeat the lm command thre

[R] Odp: regression with ordered arguments

2011-09-27 Thread Petr PIKAL
Hi > Dear R listers, > > I am trying to be a new R user, but life is not that easy. > My problem is the following one: let's assume to have 3 outcome variables > (y1, y2, y3) and 3 explanatory ones (x1, x2, x3). > How can I run the following three separate regressions without having to > repeat

Re: [R] Mahalanobis Distance

2011-09-27 Thread david.jessop
Hi One thought would be to fit say a GARCH model to your historical data series, divide the returns by the sigma estimates and then repeat. This would have the advantage of getting the data to be closer to the same scale. Regards David -Original Message- From: r-help-boun...@r-pro

[R] creating a vector automatically containing numbers 1, 100, 10000, 1000000, ...

2011-09-27 Thread Marion Wenty
hello, i am looking for a way to get a vector containing the numbers: 1,100,1,100,... each element should have two ceros more than the one before it until the number 1e+200 without using a loop. thank you very much in advance for your help! marion [[alternative HTML version

Re: [R] creating a vector automatically containing numbers 1, 100, 10000, 1000000, ...

2011-09-27 Thread Barry Rowlingson
On Tue, Sep 27, 2011 at 9:33 AM, Marion Wenty wrote: > hello, > > i am looking for a way to get a vector containing the numbers: > > 1,100,1,100,... > > each element should have two ceros more than the one before it until the > number > > 1e+200 > > without using a loop. 10^(seq(0,200,by

[R] Auto size of plots.

2011-09-27 Thread Joel
Hi I'm wondering if there is anyway to auto set the margin of a plot. Right now I'm setting it with par(mar=...) so that all the text for a bar shows up inside the plot. But I don't want to change par(mar=) for every new plot I make. So is there any way to tell R to increase the margin automatic

Re: [R] two-way anova help

2011-09-27 Thread Indrajit Sengupta
Hi Paul, Let me ask you one question - when you say "tank" does it indicate some kind of chamber or area in which all the 9 pairs are tested / treated / observed? If so - then each of the tanks would constitute a sort of block or a homogeneous group. Your data would look like this: Obs    T

Re: [R] creating a vector automatically containing numbers 1, 100, 10000, 1000000, ...

2011-09-27 Thread Marion Wenty
hello barry, thank you very much! i had thought of the seq function but only in regard to normal differences. marion 2011/9/27 Barry Rowlingson > On Tue, Sep 27, 2011 at 9:33 AM, Marion Wenty > wrote: > > hello, > > > > i am looking for a way to get a vector containing the numbers: > > > > 1,10

Re: [R] two-way anova help

2011-09-27 Thread S Ellison
Austin, As you describe it, 'tank' is indeed nested within 'cross' - no tank contains the offspring from more than one cross. How you treat that depends on whether the tank effect is fixed or random. I would _guess_ it's essentially a nuisance effect; if it were the principal effect of inte

[R] Workflow for binary classification problem using svm via e1071 package

2011-09-27 Thread Jokel Meyer
Dear R-list! I am using the e1071 package in R to solve a binary classification problem in a dataset of round 180 predictor variables (blood metabolites) of two groups of subjects (patients and healthy controls). I am confused regarding the correct way to assess the classification accuracy of the t

[R] Coercing a character zoo to a numeric

2011-09-27 Thread Ashim Kapoor
Dear R-helpers, It seems to me that a character zoo cannot be coerced to a numeric zoo. Below is a minimal example. Can someone tell me what I have done wrong? > z<-zoo(1:4,order.by=1:4) > coredata(z)<-as.character(coredata(z)) > str(z) ‘zoo’ series from 1 to 4 Data: chr [1:4] "1" "2" "3" "4"

[R] sm.regression , one-covariate graph and regression line width

2011-09-27 Thread Giulio Di Giovanni
Hi all, I'm using sm library. In the two-dimensional plot of the analysis with one covariate, I'm able to modify several graphic parameters, either specifying them directly in the sm.regression() function, either through sm.options().The only graphical parameter i cannot modify is the width of

[R] change rownames

2011-09-27 Thread Charlotte . Ndiribe
Hi All, How do I add "com" to the row names of a data frame, without deleting the plot numbers? 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-gu

Re: [R] regression with ordered arguments

2011-09-27 Thread Francesco Sarracino
Dear Petr, thank you so much for your quick reply. I was sure that there were some smart ways to address my issue. I went through it and took some time to look at the help for lapply and mapply. However, some doubts still remain. Following your example, I did: lll <-vector(mode = "list", length =

Re: [R] Coercing a character zoo to a numeric

2011-09-27 Thread R. Michael Weylandt
Yes, once made into a character zoo, the core data is marked to be of mode "character" and most attempts to modify involve implicit coercion to that mode. The following however works: library(zoo) z <- zoo(1:4, order.by=1:4) str(z) z.Str <- z coredata(z.Str) <- as.character(coredata(z)) str(z.St

Re: [R] Coercing a character zoo to a numeric

2011-09-27 Thread Ashim Kapoor
Dear Michael, I don't think this is mentioned in the zoo FAQ. May I ask where you read this? Some references ? Thank you for your help, Ashim On Tue, Sep 27, 2011 at 4:06 PM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > Yes, once made into a character zoo, the core data is marked

[R] Pearson chi-square test

2011-09-27 Thread Michael Haenlein
Dear all, I have some trouble understanding the chisq.test function. Take the following example: set.seed(1) A <- cut(runif(100),c(0.0, 0.35, 0.50, 0.65, 1.00), labels=FALSE) B <- cut(runif(100),c(0.0, 0.25, 0.40, 0.75, 1.00), labels=FALSE) C <- cut(runif(100),c(0.0, 0.25, 0.50, 0.80, 1.00), labe

Re: [R] Coercing a character zoo to a numeric

2011-09-27 Thread R. Michael Weylandt
It's just a guess from playing around with a few things. The author of the package is on this list and he could both confirm that I'm right and say why exactly it is implemented like this. My hunch is that it ultimately comes from the fact that coredata(z) != z Consider this: x = letters[1:5] x

Re: [R] Coercing a character zoo to a numeric

2011-09-27 Thread Ashim Kapoor
Dear Micheal, Thank you. So to make a zoo which has factors in into a numeric,we have to go from factor to character to numeric. The coredata goes fine from factor to character. In the numeric conversion we need a new zoo object. Best, Ashim On Tue, Sep 27, 2011 at 4:21 PM, R. Michael Weylandt <

[R] A very big matrix inside a function

2011-09-27 Thread Francisco Fabuel
Dear listers: As a part of a intermediate process, I need to use and modify a very big matrix (some 3x3) inside the body of a function. If the matrix is defined in the function, R shows a error message "Cannot allocate vector of size 6.7 Gb". But if I define the matrix before the function

[R] Question concerning Box.test

2011-09-27 Thread Samir Benzerfa
Hi everyone, I've got a question concerning the function Box.test for testing autocorrelation in my data. My data consist of (daily) returns of several stocks over time (first row=time, all other rows=stock returns). I intend to perform a Box-Ljung test for my returns (for each stock). Sinc

[R] Capturing the error information

2011-09-27 Thread arunkumar1111
Hi, I want to capture the error information without throwing it out. if i use try command it throws and also stores. and not able to get the error if i use tryCatch command. a="a" b=10 c=try(a/b) Please help -- View this message in context: http://r.789695.n4.nabble.com/Capturing-the-err

[R] Problem with zoo::window()

2011-09-27 Thread Agustin Lobo
I have the following time series: > class(CCasadesz2) [1] "zoo" > setmanes <- cut(time(CCasadesz2),breaks="weeks") > CCasadeswz <- aggregate(CCasadesz2,sum,by=setmanes) > class(CCasadeswz) [1] "zoo" > summary(CCasadeswz) Index CCasadeswz 2009-01-12 00:00:00: 1 Min. :

Re: [R] Coercing a character zoo to a numeric

2011-09-27 Thread R. Michael Weylandt
Yes, that sounds right. Michael PS -- If you are interested, the code zoo:::`coredata<-.zoo` contains the line x[] <- value confirming my hunch about the old mode being inherited unless a coercion to a more general one is needed. On Tue, Sep 27, 2011 at 7:01 AM, Ashim Kapoor wrote: > Dear Mi

Re: [R] Question concerning Box.test

2011-09-27 Thread R. Michael Weylandt
Did you try regular apply? If you have univariate input, there's no reason to use the multivariate mapply. Or more generally: apply(P[-1,],1,function(p) Box.test(p)$p.value) Michael On Tue, Sep 27, 2011 at 4:45 AM, Samir Benzerfa wrote: > Hi everyone, > > > > I've got a question concerning the

Re: [R] Intersection between circle and line?

2011-09-27 Thread Chris82
Thanks! In principle it is a mathematical problem. I have already found some solutions with google. I thought there is maybe an existing R function or package which handel this stuff. But it seems not to be. sos package gives me no suitable information for that. With best regards -- View this

Re: [R] Pearson chi-square test

2011-09-27 Thread Meyners, Michael
Not sure what you want to test here with two matrices, but reading the manual helps here as well: y a vector; ignored if x is a matrix. x and y are matrices in your example, so it comes as no surprise that you get different results. On top of that, your manual calculation is not correct

Re: [R] Changing colour in barchart

2011-09-27 Thread shikantaza
Thanks for your help - very useful! Martyn. -- View this message in context: http://r.789695.n4.nabble.com/Changing-colour-in-barchart-tp3843209p3846866.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Capturing the error information

2011-09-27 Thread Duncan Murdoch
On 11-09-27 5:39 AM, arunkumar wrote: Hi, I want to capture the error information without throwing it out. if i use try command it throws and also stores. and not able to get the error if i use tryCatch command. a="a" b=10 c=try(a/b) That's how. c has now captured the error informati

Re: [R] Problem with zoo::window()

2011-09-27 Thread Gabor Grothendieck
On Tue, Sep 27, 2011 at 5:23 AM, Agustin Lobo wrote: > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > Provide the output of dput(CCasadesz2) or if that is very large try to cut it down to make the

Re: [R] Coercing a character zoo to a numeric

2011-09-27 Thread Gabor Grothendieck
On Tue, Sep 27, 2011 at 5:56 AM, Ashim Kapoor wrote: > Dear R-helpers, > > It seems to me that a character zoo cannot be coerced to a numeric zoo. > Below is a minimal example. Can someone tell me what I have done wrong? > >> z<-zoo(1:4,order.by=1:4) >> coredata(z)<-as.character(coredata(z)) >> st

Re: [R] regression with ordered arguments

2011-09-27 Thread Petr PIKAL
Hi Francesco > Dear Petr, > > thank you so much for your quick reply. I was sure that there were some > smart ways to address my issue. I went through it and took some time to > look at the help for lapply and mapply. > However, some doubts still remain. Following your example, I did: > lll <-v

[R] wgrib2 for windows 7

2011-09-27 Thread Bhaskaran
Hi all, I want to install wgrib2 on my windows 7 laptop. It appears that a precompiled version exists and works for many. I managed to download a precompiled version and placed it in a directory and added this directory to the PATH. However, when execute R-command, I get the error suggesting t

[R] ANOVA define as factor or not

2011-09-27 Thread HronnE
Hi all This is probably a simple problem but somehow I am having much trouble with finding a solution, so I seek your help! I have a data-set with continuous response variables. The explanatory variably is 4xpH treatments (so 8.08, 7.94, 7.81 and 7.71) so also continuous and not technically fac

[R] model selection using logistf package

2011-09-27 Thread mael
Hi everyone, I'm wondering how to select the "best" model when using logistf? AIC does not work neither does anova. I tried fitting a glm model but got the separation warning message so I tried using the logistf package but as I stepwise simplify the model I don't know if the simplification is mot

[R] binomial logistic regression question

2011-09-27 Thread majesty
Dear subscribers, I am looking for a function which would allow me to model the dependent variable as the number of successes in a series of Bernoulli trials. My data looks like this ID TRIALS SUCCESSESS INDEP1 INDEP2 INDEP3 1 00.273 0.055 0.156 2

Re: [R] model selection using logistf package

2011-09-27 Thread Frank Harrell
Stepwise variable selection without heavy penalization is invalid. Frank mael wrote: > > Hi everyone, > > I'm wondering how to select the "best" model when using logistf? AIC does > not work neither does anova. I tried fitting a glm model but got the > separation warning message so I tried using

Re: [R] Problem with zoo::window()

2011-09-27 Thread Gabor Grothendieck
On Tue, Sep 27, 2011 at 5:23 AM, Agustin Lobo wrote: > I have the following time series: > >> class(CCasadesz2) > [1] "zoo" >> setmanes <- cut(time(CCasadesz2),breaks="weeks") >> CCasadeswz <- aggregate(CCasadesz2,sum,by=setmanes) cut produces a "factor", not a "Date". The by= argument in aggrega

Re: [R] regression with ordered arguments

2011-09-27 Thread Francesco Sarracino
That's cool! it works :-))) for me (as a stata user) these are quite basic things and I didn't find them anywhere for what concerns R. I can't figure out why. Really, thank you so much, f. On 27 September 2011 14:20, Petr PIKAL wrote: > Hi Francesco > > > Dear Petr, > > > > thank you so much

Re: [R] binomial logistic regression question

2011-09-27 Thread Patrick Breheny
On 09/27/2011 07:53 AM, majesty wrote: Dear subscribers, I am looking for a function which would allow me to model the dependent variable as the number of successes in a series of Bernoulli trials. My data looks like this ID TRIALS SUCCESSESS INDEP1 INDEP2 INDEP3 1 0

Re: [R] Mahalanobis Distance

2011-09-27 Thread David L Carlson
David Cross is correct. Your covariance matrix is singular because you have more columns (15) than rows (2). David actually produced the covariance matrix for cbind(s.1, s.2) which is not singular, but you are using rbind(s.1, s.2). Try cor(rbind(s.1, s.2)) and you will see that the correlations ar

[R] Matrix and list indices

2011-09-27 Thread fernando.cabrera
Hi guys, I am trying to replace all elements of earth that are equal to zero with their corresponding elements in mars. I can do the replace with a bunch of for-loops, but I don't think this is the R way of doing things. my_list <- list( earth=array(c(0,0,45,0,0,45,0,45),dim=c(2,2,2)), mars=ar

[R] Counting similar rows

2011-09-27 Thread Metronome123
Startsituation: structure(c(1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1), .Dim = 4:5, .Dimnames = structure(list(subject = c("s1", "s2", "s3", "s4"), class = c("c1", "c2", "c3", "c4", "c5")), .Names = c("subject", "class")), class = c("xtabs", "table"), call = xtabs(formula = ~s

[R] How does the survfit.coxph calculate the survival value?

2011-09-27 Thread koshihaku
Sorry for a long question. I am in an urgent using R to fit the cox proportional model. My data is a data frame including 100 individuals which are software stress tests. There are time-to-failure and six covariates meaning the system resource (every 4 minutes). Is it possible to use R to fit the

[R] M-Splines design matrix

2011-09-27 Thread Tigisti G
Hi Can any one inform me an r package used to fit Cubic M-splines or r functions used to have design and penalty matrices in fitting cubic  M-splines please? Thanks, Tigist [[alternative HTML version deleted]] __ R-help@r-project.org mailing

Re: [R] Matrix and list indices

2011-09-27 Thread R. Michael Weylandt
On Tue, Sep 27, 2011 at 9:43 AM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > Untested, I believe this should work, though you might need to modify for > floating point funny business in testing the equalities: > > my_list <- list( earth=array(c(0,0,45,0,0,45,0,45),dim=c(2,2,2)), > m

Re: [R] change rownames

2011-09-27 Thread R. Michael Weylandt
Your data frame does not seem to have come through with the formatting. Could you send a plain text example (easily created using dput() ) of what you have now and what you want? Michael On Tue, Sep 27, 2011 at 7:24 AM, wrote: > Hi, > > I already know row.names(comm)[1:5]<- paste("com", 1:5, >

[R] Problem about rbpspline-selection of knots

2011-09-27 Thread Elif Keten
Hi, My problem is that i will use rbpspline{SpatialExtremes} to fit a penalized spline with radial basis functions to my data but i have two predictor variables and i cannot select knots. In R help there is an example such that n <- 200 x <- runif(n) fun <- function(x) sin(3 * pi * x) y <- fun(

Re: [R] ANOVA define as factor or not

2011-09-27 Thread Jean V Adams
HronnE wrote on 09/27/2011 06:27:38 AM: > > Hi all > > This is probably a simple problem but somehow I am having much trouble with > finding a solution, so I seek your help! > > I have a data-set with continuous response variables. The explanatory > variably is 4xpH treatments (so 8.08, 7.94, 7

Re: [R] Pearson chi-square test

2011-09-27 Thread Meyners, Michael
Just for completeness: the manual calculation you'd want is most likely sum((x-y)^2 / (x+y)) (that's one you can find on the Wikipedia link you provided). To get the same from chisq.test, try something like chisq.test(data.frame(x,y)[,c(3,6)]) (there are surely smarter ways, but at least it

[R] Keep consecutive year observations (remove gap's) in panel data (dataframes). Difficulties in using lag(). Package plm.

2011-09-27 Thread Cecilia Carmo
Hi everyone. I have two questions. I’ve found some other questions and answers similar to these but they didn’t solve my problem. I’m working with a panel of firm/years observations (see my reproducible example). I’m using the plm package. My panel not only is unbalanced but also have some ga

Re: [R] Pearson chi-square test

2011-09-27 Thread Michael Haenlein
Dear Michael, Thanks very much for your answers! The purpose of my analysis is to test whether the contingency table x is different from the contingency table y. Or, to put it differently, whether there is a significant difference between the joint distribution A&B and A&C. Based on your

Re: [R] binomial logistic regression question

2011-09-27 Thread Göran Broström
On Tue, Sep 27, 2011 at 2:59 PM, Patrick Breheny wrote: > On 09/27/2011 07:53 AM, majesty wrote: > >> Dear subscribers, >> >> I am looking for a function which would allow me to model the dependent >> variable as the number of successes in a series of Bernoulli trials. My >> data >> looks like thi

Re: [R] SVM accuracy question

2011-09-27 Thread Riccardo G-Mail
Il 27/09/11 01:58, R. Michael Weylandt ha scritto: Why exactly do you want to "stabilize" your results? If it's in preparation for publication/classroom demo/etc., certainly resetting the seed before each run (and hence getting the same sample() output) will make your results exactly reproducibl

Re: [R] Counting similar rows

2011-09-27 Thread Jean V Adams
Metronome123 wrote on 09/27/2011 07:24:50 AM: > > Startsituation: > > structure(c(1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, > 0, 1, 1), .Dim = 4:5, .Dimnames = structure(list(subject = c("s1", > "s2", "s3", "s4"), class = c("c1", "c2", "c3", "c4", "c5")), .Names = > c("subject", > "c

Re: [R] Pearson chi-square test

2011-09-27 Thread Meyners, Michael
I suspect that the chisquare-test might not be appropriate, as you have constraints (same number of observations for A in both contingency tables). I further suspect that there is no test readily available for that, but I might be wrong. Maybe randomization tests could help here, but it would re

Re: [R] ANOVA define as factor or not

2011-09-27 Thread HronnE
Thank you very much for a quick reply! I had not realized the degrees of freedom changed. It was my lack of understanding of the "aov" function. I will continue defining the pH as factor for the ANOVA's. Cheers, Hronn - -- Hrönn Egilsdóttir PhD Student Marine Research Institute Skúlaga

Re: [R] wgrib2 for windows 7

2011-09-27 Thread Uwe Ligges
On 27.09.2011 14:06, Bhaskaran wrote: Hi all, I want to install wgrib2 I guess you will have to explain what wgrib2 is and why it is related to R. Uwe Ligges on my windows 7 laptop. It appears that a precompiled version exists and works for many. I managed to download a precompiled ver

Re: [R] Question concerning Box.test

2011-09-27 Thread R. Michael Weylandt
Send this again using dput() to give a plain text output and I'll look at it. Also, I think you should probably look into the difference between a row and a column. Michael On Tue, Sep 27, 2011 at 11:48 AM, Samir Benzerfa wrote: > Many thanks for your hint. I tried regular apply now. However,

[R] searching several subsequences in a single string sequence

2011-09-27 Thread Marcelo Araya
Hi all I am analyzing bird song element sequences. I would like to know how can I get how many times a given subsequence is found in single string sequence. For example: If I have this single sequence: ABCABAABABABCAB I am looking for the subsequence "ABC". Want I need to g

Re: [R] searching several subsequences in a single string sequence

2011-09-27 Thread Ivan Calandra
Hi Marcelo, Try this: x <- "ABCABAABABABCAB" length(gregexpr(pattern="ABC", x)[[1]]) See ?gregexpr for more details (though I admit that it is not easy to understand this help page) HTH, Ivan Le 9/27/2011 18:51, Marcelo Araya a écrit : Hi all I am analyzing bird song element sequences. I

Re: [R] searching several subsequences in a single string sequence

2011-09-27 Thread Barry Rowlingson
On Tue, Sep 27, 2011 at 5:51 PM, Marcelo Araya wrote: > Hi all > > > > I am analyzing bird song element sequences. I would like to know how can I > get how many times a given subsequence is found in single string sequence. > > > > > > For example: > > > > If I have this single sequence: > > > > AB

[R] Adding axis to an ellipse: "ellipse" package

2011-09-27 Thread Antoine
Dear list members, This might be a silly question but I just can't figure it out. I am using the "ellipse" package on covariance matrices. I would simply like to plot my ellipses WITH its two axis ploted as well. These axis represents the 2 eigen vectors of my matrix and it is important that I can

Re: [R] merger two 3-d scatter plot

2011-09-27 Thread Uwe Ligges
If you are talking about the scatterplot3d package, and we assume your data is in data.frame called "dat": library("scatterplot3d") s3d <- scatterplot3d(dat$obs30, dat$Cases, dat$RANK1) s3d$points3d(dat$obs30, dat$Cases, dat$RANK2, col=2) Uwe Ligges On 26.09.2011 22:08, XINLI LI wrote: De

Re: [R] Counting similar rows

2011-09-27 Thread Metronome123
Jean: Thanks! Works great! Lars Op 27 sep. 2011 (w39), om 17:22 heeft Jean V Adams [via R] het volgende geschreven: df <- as.data.frame(unclass(xt)) dfu <- unique(df) class_cnt <- apply(dfu, 1, sum) subject_cnt <- tabulate(match(apply(df, 1, paste, collapse="-"), apply(dfu, 1, pa

Re: [R] survival analysis: interval censored data

2011-09-27 Thread Ruth Arias
halo david when I use type= 'interval' Call: survfit(formula = Surv(ingreso, fecha, estado, type = "interval") ~     categoria)     categoria=C  time n.risk n.event survival std.err lower 95% CI upper 95% CI  2004  95.00   13.14    0.862  0.0354    0.795    0.934  2007  3

Re: [R] searching several subsequences in a single string sequence

2011-09-27 Thread Jean V Adams
Barry Rowlingson wrote on 09/27/2011 12:06:21 PM: > > On Tue, Sep 27, 2011 at 5:51 PM, Marcelo Araya wrote: > > Hi all > > > > > > > > I am analyzing bird song element sequences. I would like to know how can I > > get how many times a given subsequence is found in single string sequence. > > >

Re: [R] Mahalanobis Distance

2011-09-27 Thread jorgeA
Hello David(s), First of all, thank you for your help. I was running some tests, and I wish to know if I have correctly understood your explanation. Well, when I use rbind(), I get the variables binded by row, and when I use cbind() I get the variables binded by column. The dist() function, as t

Re: [R] M-Splines design matrix

2011-09-27 Thread Spencer Graves
library(sos) ???'M-spline' This produces ZERO matches. If you want a nonnegative fit and you don't necessarily need M-splines, there are many ways to do that, some of which can be found with the sos package (which also includes a vignette). There are many different packages of

Re: [R] my R query

2011-09-27 Thread David Winsemius
On Sep 27, 2011, at 1:47 PM, arindam fadikar wrote: I have made a level plot in R of a variable using the lattice package. This grid corresponds to South Asia. I am only interested in viewing the values of this variable (aerosol optical depth) for certain countries in South Asia. I have a dummy

Re: [R] normalizing a negative binomial distribution and/or incorporating variance structures in a GAMM

2011-09-27 Thread Ben Bolker
Meredith Jantzen uwo.ca> writes: >  Hello everyone, Apologies in advance, as this is partially a stats > question and partially an R question.  I have been using a GAM to > model the activity level of bats going into and coming out from a > forested edge.  I had eight microphones set up in a lin

[R] How can I check a package is installed or not?

2011-09-27 Thread Fabrice Tourre
Dear list, How can I detect a package is installed or not? If not, then install it. For example, in a script, I want to check the package DESeq is installed or not. If not, then I will using this script to install it. source("http://www.bioconductor.org/biocLite.R";) biocLite("DESeq") The pseud

[R] inset one map on top of another map

2011-09-27 Thread Jean V Adams
I want to overlay a small inset map on top of another map, but I can't figure out how to do it. For example, here are two different maps: # map 1 - Ohio map("state", region= "ohio") # map 2 - US with Ohio darkened map("state") map("state", region="ohio", fill=T, add=T) I would like to add map

Re: [R] Data import

2011-09-27 Thread B77S
I see what you mean. Sorry and thanks for pointing that out to me Ben. bbolker wrote: > > B77S auburn.edu> writes: > >> >> I have never used that function, but I know that with read.csv() you can >> do >> the following to select only the columns you want: >> >> chosen_vars <- read.csv("Workb

Re: [R] How can I check a package is installed or not?

2011-09-27 Thread David Winsemius
On Sep 27, 2011, at 3:19 PM, Fabrice Tourre wrote: Dear list, How can I detect a package is installed or not? If not, then install it. For example, in a script, I want to check the package DESeq is installed or not. If not, then I will using this script to install it. source("http://www.b

[R] compare proportions

2011-09-27 Thread array chip
Hi, I have a seemingly simple proportional test.  here is the question I am trying to answer:   There is a test running each day in the lab, the test comes out as either positive or negative. So at the end of each month, we can calculate a positive rate in that month as the proportion of positive

[R] remove NaN from element in a vector in a list

2011-09-27 Thread Ben qant
Hello, What is the best way to turn a matrix into a list removing NaN's? I'm new to R... Start: > mt = matrix(c(1,4,NaN,5,3,6),2,3) > mt [,1] [,2] [,3] [1,]1 NaN3 [2,]456 Desired result: > lst [[1]] [1] 1 3 [[2]] [1] 4 5 6 Thanks! Ben [[alternative HTML v

[R] problem with switch function across R versions 2.10 and 2.13

2011-09-27 Thread jose romero
Hello, The following piece of code works fine in R.2.10 (ubuntu): switch(distr,         normal    = {if (is.infinite(param["desv"]))                 n <- c(n,"La desv. estándar no puede ser Inf.")                    if (param["desv"]<0)                 n <- c(n,"La desv. estándar no pue

Re: [R] remove NaN from element in a vector in a list

2011-09-27 Thread R. Michael Weylandt
Try this: alply(mt, 1, function(x) as.numeric(na.omit(x))) The as.numeric() addition may be necessary to strip the extra attributes na.omit() wants to add. Michael On Tue, Sep 27, 2011 at 4:02 PM, Ben qant wrote: > Hello, > > What is the best way to turn a matrix into a list removing NaN's? I

Re: [R] remove NaN from element in a vector in a list

2011-09-27 Thread R. Michael Weylandt
alply is from the plyr package. You'll need to call that if its not already loaded. M On Tue, Sep 27, 2011 at 4:07 PM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > Try this: > > alply(mt, 1, function(x) as.numeric(na.omit(x))) > > The as.numeric() addition may be necessary to strip

Re: [R] How can I check a package is installed or not?

2011-09-27 Thread Duncan Murdoch
On 11-09-27 3:19 PM, Fabrice Tourre wrote: Dear list, How can I detect a package is installed or not? If not, then install it. Here's one way. This might be slow if you have all of CRAN installed, but it's quick enough if you only have a few dozen packages: installed <- rownames(installed.

Re: [R] remove NaN from element in a vector in a list

2011-09-27 Thread Ben qant
Excellent! Thank you! ben On Tue, Sep 27, 2011 at 2:07 PM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > alply is from the plyr package. You'll need to call that if its not already > loaded. > > M > > > On Tue, Sep 27, 2011 at 4:07 PM, R. Michael Weylandt < > michael.weyla...@gmail.

Re: [R] problem with switch function across R versions 2.10 and 2.13

2011-09-27 Thread Duncan Murdoch
On 11-09-27 4:03 PM, jose romero wrote: Hello, The following piece of code works fine in R.2.10 (ubuntu): switch(distr, normal= {if (is.infinite(param["desv"])) n<- c(n,"La desv. estándar no puede ser Inf.") if (param["desv"]<0)

Re: [R] remove NaN from element in a vector in a list

2011-09-27 Thread David Winsemius
On Sep 27, 2011, at 4:02 PM, Ben qant wrote: Hello, What is the best way to turn a matrix into a list removing NaN's? I'm new to R... Start: mt = matrix(c(1,4,NaN,5,3,6),2,3) mt [,1] [,2] [,3] [1,]1 NaN3 [2,]456 > apply(mt, 1, function(x) x[!is.nan(x)] ) [[1]]

Re: [R] How can I check a package is installed or not?

2011-09-27 Thread Fabrice Tourre
Thank you for your sharing I got it. On Tue, Sep 27, 2011 at 9:44 PM, David Winsemius wrote: > > On Sep 27, 2011, at 3:19 PM, Fabrice Tourre wrote: > >> Dear list, >> >> How can I detect a package is installed or not? If not, then install it. >> >> For example, in a script, I want to check the p

Re: [R] remove NaN from element in a vector in a list

2011-09-27 Thread Hadley Wickham
>> apply(mt, 1, function(x) x[!is.nan(x)] ) > [[1]] > [1] 1 3 > > [[2]] > [1] 4 5 6 You need to be a little careful with apply: > mt2 <- matrix(c(1,4,2,5,3,6),2,3) > apply(mt2, 1, function(x) x[!is.nan(x)] ) [,1] [,2] [1,]14 [2,]25 [3,]36 Depending on the input you w

Re: [R] How can I check a package is installed or not?

2011-09-27 Thread Robin Cura
Hi I'm using this :) if (is.element('DESeq', installed.packages()[,1]) == FALSE) { install.packages('DESeq') } Robin 2011/9/27 Fabrice Tourre > Dear list, > > How can I detect a package is installed or not? If not, then install it. > > For example, in a script, I want to check the package DES

[R] Installing packages in R for UBUNTU

2011-09-27 Thread gbrenes
Hi. We downloaded R 2.13.1 for UBUNTU. We try to install several packages: car, maps, maptools, raster, and we found the following warning or error message: " Error: **buffer overflow detected ***=/user/lib/R/bin/exec/R terminated*** We also found the usual error message that the packages are

[R] Is there a "latex" summary function in the quantreg package for just 1 tau?

2011-09-27 Thread Tal Galili
Hello dear R help members, I wish to get a nice LaTeX table for a rq object. Trying to use the functions I found so far wouldn't work. I can start opening the functions up, but I am wondering if I had missed some function which is the one I should be using. Here is an example session for a bunch

Re: [R] Installing packages in R for UBUNTU

2011-09-27 Thread Henri-Paul Indiogine
Hi! 2011/9/27 : > We downloaded R 2.13.1 for UBUNTU.  We try to install several packages: > car, maps, maptools, raster, and we found the following warning or error > message: I suggest to use apt-get (synaptic) as much as possible to install R packages and then use install.packages() for those

Re: [R] Mahalanobis Distance

2011-09-27 Thread David L Carlson
Since you are only looking at the distance between two points, they must fall on a line so no matter how many values you have for each point, their dimension is still 1. Mahalanobis distance is a way of measuring distance in multivariate space when the variables (columns) are correlated with one an

Re: [R] searching several subsequences in a single string sequence

2011-09-27 Thread Barry Rowlingson
On Tue, Sep 27, 2011 at 6:15 PM, Jean V Adams wrote: > For example, > > songs <- c("ABCABAABABABCAB", "ABACAB", "ABABCABCBC") > counts <- gregexpr("ABC", songs) > sapply(counts, length) That will still return '1' for the case where its not found, because of the -1. sapply(counts,function(x){su

Re: [R] Is there a "latex" summary function in the quantreg package for just 1 tau?

2011-09-27 Thread Frank Harrell
Tal, require(rms) f <- Rq() print(f, latex=TRUE) latex(f) Frank Tal Galili wrote: > > Hello dear R help members, > > I wish to get a nice LaTeX table for a rq object. > Trying to use the functions I found so far wouldn't work. I can > start opening the functions up, but I am wondering if

[R] Equivalent to regMatchPos in R.

2011-09-27 Thread Michael Karol
R Experts: I am trying to isolate the numeric value of day from a string that might look like "Cycle 1 Day 8" or "Cycle 12 Day 15". In essence, what I need is a function that can look at a character string and tell me the location within the string where it matches with a given string. I

Re: [R] Equivalent to regMatchPos in R.

2011-09-27 Thread Gabor Grothendieck
On Tue, Sep 27, 2011 at 5:49 PM, Michael Karol wrote: > R Experts: > > > > I am trying to isolate the numeric value of day from a string that might > look like "Cycle 1 Day 8" or "Cycle 12 Day 15". > > > > In essence, what I need is a function that can look at a character > string and tell me the

Re: [R] Equivalent to regMatchPos in R.

2011-09-27 Thread William Dunlap
regexpr() can be used instead of regMatchPos() in S+ and R. (It has been in S+ longer than regMatchPos.) Instead of using regexpr and substring I usually use sub() or gsub(). E.g., since S+ 8.0 and a long time ago in R you can do x <- c("Cycle 1 Day 15 Hour 2", "Cycle 2 Day 3") sub("^.*Day +

  1   2   >