[R] Trouble with performing post hoc analysis Tukey for lme model using ghlt

2011-09-27 Thread l.m.t
Hi, I am new to R and I am trying to perform a post hoc tukey test using the multcomp package's ghlt for a lme model. My first attempt at doing so gave me an output, HOWEVER I have tried to do this again, it keeps coming up with the error: (Error in contrMat(table(mf[[nm]]), type = types[pm]) :

Re: [R] Data transformation & cleaning

2011-09-27 Thread Daniel Malter
On a methodological level, if the choices do not correspond on a cardinal or at least ordinal scale, you don't want to use correlations. Instead you should probably use Cramer's V, in particular if the choices are multinomial. Whether the wide format is necessary will depend on the format the funct

Re: [R] GAMs in R : How to put the new data into the model?

2011-09-27 Thread Daniel Malter
Your questions is pretty opaque. Please adhere to the posting guide. Provide a self-contained (!) example (i.e., code) that reproduces your problem. Generally, you would predict like this: x<-rnorm(100) e<-rnorm(100) y<-x+x^2+e reg<-gam(y~s(x)) plot(reg) predict(reg,newdata=data.frame(x=2)) wher

[R] GAMs in R : How to put the new data into the model?

2011-09-27 Thread pigpigmeow
I have 5 GAMs ( model1, model2, model3, model4 and model5) Before I use some data X(predictor -January to June data) to form a equation and calculate the expected value of Y (predictand -January to June). After variable selection, GAMs (Model 1)were bulit up! R-square :0.40 NOW, I want to use new

[R] Data transformation & cleaning

2011-09-27 Thread pip56789
Hi, I have a few methodological and implementation questions for ya'll. Thank you in advance for your help. I have a dataset that reflects people's preference choices. I want to see if there's any kind of clustering effect among certain preference choices (e.g. do people who pick choice A also pic

[R] Does the bashaz give the breslow estimator of baseline hazard?

2011-09-27 Thread koshihaku
Dear R-users, I am checking the Cox proportional hazard model with six covariates, and all of them are time-dependent. I fitted cox model and try to get the beslow estimator for the baseline cumulative hazard function. My question is whether the result of basehaz is actually a breslow estimato

Re: [R] Removing objects and clearing memory

2011-09-27 Thread Kondor
>>> How do I remove all objects except one in R? Here is another way. ls() gives you a list. get a number (n) of the item you'd like to keep, and then do: rm(list=ls()[n+1:last]) rm(list=ls()[1:n-1]) ls() should return only one object after this. -- View this message in context: http://r.78

[R] Package lattice: levelplot for matrix method produces images with blank lines ...

2011-09-27 Thread Pepito Grillo
Dear R-users, I am trying to produce a levelplot of a matrix of values (430x430) using "levelplot" from lattice package. My problem is that I am not able to obtain an image without blank/white lines in some rows and columns (a continuous image). Attached are two png files (different resolution)

[R] Reading column names with spaces using dbGetQuery

2011-09-27 Thread Raji
I have been trying to read a dataset which has spaces in column names using dbGetQuery from RJDBC. * dataFrame<-dbGetQuery(conn,"select 'Sepal Length','Sepal Width' from "326_1_Result")* The resulting dataframe contains column names as "*Sepal.Length" "Sepal.Width" * But i would like to mainta

Re: [R] inset one map on top of another map

2011-09-27 Thread Ray Brownrigg
On Wed, 28 Sep 2011, Jean V Adams wrote: > 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("stat

Re: [R] [SPAM?] read.csv behaviour

2011-09-27 Thread Jeff Newmiller
The consensus is that it is a very bad idea for a file nominally described as a CSV file to have a varying numbers of fields from record to record. If you have need for such a file and go to whatever lengths you need to in order to create it, please mark it as something other than a CSV file whe

[R] read.csv behaviour

2011-09-27 Thread Mehmet Suzen
This might be obvious but I was wondering if anyone knows quick and easy way of writing out a CSV file with varying row lengths, ideally an initial data read from a CSV file which has the same format. See example below. I found it quite strange that R cannot write it in one go, so one must appen

Re: [R] Question concerning Box.test

2011-09-27 Thread R. Michael Weylandt
Plaintext data looks like this: P <- structure(list(X77.BANK = c(0, 0, 0, 0.003181659, -0.006386799, 0.028028724, -0.015347692, -0.015910002, 0.00322897, -0.013062473, 0, -0.03809005, 0.021189299, -0.003460532, -0.010550182, 0.01744389, 0.010139631, -0.01709, 0.010299957, 0), A...A.MATERIAL =

Re: [R] inset one map on top of another map

2011-09-27 Thread Yihui Xie
How about the subplot() function in the TeachingDemos package? It is basically using par() but you do not have to learn all the gory details. Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On T

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 +

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

[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] 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

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] 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] 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

[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

[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

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

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 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 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] 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 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] 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 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] 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

[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

[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] 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

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

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

[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

[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

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

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] 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] 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] 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] 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] 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] 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

[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] 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

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

[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] 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,

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] 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] 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] 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] 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] 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] 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

[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 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

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

[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] 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, >

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

[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

[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] 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] 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

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

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] 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] 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] 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

[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

[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] 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] 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

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

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] 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] 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] 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] 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] 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] 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] 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

[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. :

[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] 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] 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

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 <

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

[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 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

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] 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 =

[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

[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] 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"

  1   2   >