[R] help on using try() to catch an error

2008-02-14 Thread Juliet Hannah
Dear R Users, I have the following glm, which I am running several times in a loop (I am not including the full code): reduced_model <- NULL; full_model <- NULL; reduced_model <- try(glm.fit(X4,n,family=poisson(link="log"))) full_model <- try(glm.fit(X5,n,family=poisson(link="log"))); On some oc

Re: [R] How to plot fitted values from lmer (lme4 package)?

2008-02-14 Thread jebyrnes
The trick is to use the fitted() function, not predict(), to get your fitted values. You should then be able to use that vector of values in just the same way that you use your current mean values as below. Darren Norris wrote: > > > lmodel<-with(a_dataframe,lm(mean_ind~sin(time*2*pi)+cos(tim

Re: [R] data frame question

2008-02-14 Thread Bill.Venables
... or in one step df <- transform(df, col1 = ifelse(col1 > 3, NA, col1)) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of K. Elo Sent: Friday, 15 February 2008 4:29 PM To: r-help@r-project.org Subject: Re: [R] data frame question Hi,

[R] tests of lognormal distribution

2008-02-14 Thread Hyunchul Kim
Hi all, I have a data of lognormal distribution (sample size > 1,000,000). What I want to do is 1) to test if my dataset is a lognormal distribution or not (Histogram shows a nice normal distribution in log scale but I want to check) 2) two subsets from this dataset have same mean or not (like "t

Re: [R] data frame question

2008-02-14 Thread K. Elo
Hi, joseph wrote (15.2.2008): > Thanks. I have another question: > In the following data frame df, I want to replace all values in col1 > that are higher than 3 with NA. df= data.frame(col1=c(1:5, NA),col2= > c(2,NA,4:7)) My suggestion: x<-df$col1; x[ x>3 ]<-NA; df$col1<-x; rm(x) -Kimmo __

[R] tests of lognormal distribution in R

2008-02-14 Thread Hyunchul Kim
Hi all, I have a data of lognormal distribution (sample size > 1,000,000). What I want to do is 1) to test if my dataset is a lognormal distribution or not (Histogram shows a nice normal distribution in log scale but I want to check) 2) two subsets from this dataset have same mean or not (like "t

Re: [R] Re trieving data frames from a for loop

2008-02-14 Thread jebyrnes
Have you tried making a list of data frames instead? So data.list<-list() for (i in 1:20) { g<-sample(rep(LETTERS[1:2],each=10)) #make a name a.name<-paste("combination",i,sep="") #add it to the list of data frames data.list[[a.name]]<-data.frame(tab,g) } This shoul

Re: [R] Remove rows with NA across all columns

2008-02-14 Thread Bert Gunter
Learn to use the power and flexibility of R subscripting. ## Warning:untested apply(df,1,function(x)any(!is.na(x))) gives TRUE for all rows that aren't all NA's. So stick this expression into the 1st coordinate of a subscript for the df: df[apply(df,1,function(x)any(!is.na(x))),] Cheers, Bert

[R] Remove rows with NA across all columns

2008-02-14 Thread joseph
Hi I have a data frame df with 3 columns. Some rows are NA across all 3 columns. How can I remove rows with NA across all columns? df=data.frame(col1=c(1:3,NA,NA,4),col2=c(7:9,NA,NA,NA),col3=c(2:4,NA,NA,4)) Thanks Joseph

[R] How to plot fitted values from lmer (lme4 package)?

2008-02-14 Thread Darren Norris
I am modelling (at least trying to) the seasonal component of a variable using lmer. I think I am just about getting the hang of building the models but want to see what the fitted values look like. I need to plot 2 lines on the same graph - the original data ( copy of dataframe below) and the fit

[R] For Subset or Reshaping the Table

2008-02-14 Thread dinesh kumar
Hi R users I am a new user in the field of R. I want to subset or reshape a data.frame. For example I have a matrix like A B C D E F G a 1 2 3 4 5 6 7 b 4 6 8 9 5 5 6 c 3 4 4 4 3 3 6 d 1 2 4 6 8 8 9 e 5 6 7 8 9 2 3 I want to reshape the matri

Re: [R] Retrieving data frames from a for loop

2008-02-14 Thread jim holtman
Use a 'list' to capture the data within the loop: > result <- vector('list', 20) # preallocate > tab <- data.frame(x=1:20) > for (i in 1:20) { + + g<-sample(rep(LETTERS[1:2],each=10)) + result[[i]] <-data.frame(tab,g) + + } > # you can now access the combinations like this: > result[[1]]

Re: [R] Problems with Rcmdr unter JGR (Windows XP)

2008-02-14 Thread Michael Bibo
Willi Nagl gmail.com> writes: > > I try to start Rmcdr from JGR. The Rmcdr-Windows comes up correctly; but > the > Menu-Bar in the Rcmdr-Window goes away, if I try to go into the > Rmcdr-Window. > > I hope, someone has a solution. > > Regards, willi > My experience is that, under Windows,

[R] Quantile Regression R squared

2008-02-14 Thread frank frank
Dear R, I am currently trying to caculate the coefficient of determination for different quantile regression models. For example fit<-rq(Hrubra~SessileInvertebrates,tau=0.8, data=Q1) fit1<-rq(Hrubra~SessileInvertebrates,tau=0.8, data=Q2) etc Could someone please advise me how do you calculate

[R] Questions about EM algorithm

2008-02-14 Thread Hung-Hsuan Chen (Sean)
Dear all: Assume I have 3 distributions, x1, x2, and x3. x1 ~ normal(mu1, sd1) x2 ~ normal(mu2, sd2) x3 ~ normal(mu3, sd3) y1 = x1 + x2 y2 = x1 + x3 Now that the data I can observed is only y1 and y2. It is easy to estimate (mu1+m2), (mu1+mu3), (sd1^2+sd2^2) and (sd1^2+sd3^2) by EM algorithm since

[R] LMER

2008-02-14 Thread Daniel Malter
Hi, I run the following models: 1a. lmer(Y~X+(1|Subject),family=binomial(link="logit")) and 1b. lmer(Y~X+(1|Subject),family=binomial(link="logit"),method="PQL") Why does 1b produce results different from 1a? The reason why I am asking is that the help states that "PQL" is the default of GLMMs

[R] Retrieving data frames from a for loop

2008-02-14 Thread Judith Flores
Dear R-helpers, I need to retrieve the data frames generated in a for loop. What I have looks something like this: where tab is a pre-existing data frame. for (i in 1:20) { g<-sample(rep(LETTERS[1:2],each=10)) combination<-data.frame(tab,g) } I tried to name every single combi

Re: [R] data frame question

2008-02-14 Thread joseph
Thanks. I have another question: In the following data frame df, I want to replace all values in col1 that are higher than 3 with NA. df= data.frame(col1=c(1:5, NA),col2= c(2,NA,4:7)) - Original Message From: John Kane <[EMAIL PROTECTED]> To: joseph <[EMAIL PROTECTED]>; r-help@r-project.

Re: [R] dimnames

2008-02-14 Thread John Kane
?write.table and look at the row.names arguement which is what they are called in this instance. write.table(XX, file="XX.txt",quote=FALSE,sep="\t", row.names=FALSE) --- Roberto Olivares Hernandez <[EMAIL PROTECTED]> wrote: > Hi, > > I used the write.table function to save data in txt > file,

Re: [R] setting color ranges

2008-02-14 Thread Achim Zeileis
On Thu, 14 Feb 2008, samsr wrote: > > Hi, > > I need to plot a matrix using image() such that negative values are easily > distinguishable from posittive values, while also maintaining a gradation in > color with magnitude. How can I set ranges for colors in order to achieve > this. Thanks. Look

[R] forestplot() with large number of confidence intervals

2008-02-14 Thread array chip
Hi I am using forestplot() in rmeta package on a dataset of 45 point estimates with corresponding confidence intervals. The resulting plot was just too large and plotted out of the graphic window that I can not see whole picture. Is there anyway to fix this problem? Thanks ___

Re: [R] passing username and password to source()

2008-02-14 Thread [Ricardo Rodriguez] Your XEN ICT Team
Phil Spector wrote: > Ricardo - > The authentication can't be done through environmental variables -- > the only way is to send an Authorization header. I believe the > environmental variables that Dieter is thinking of are the ones that > are created on the server side based on the headers

Re: [R] plot each column of a matrix or dataframe versus x in a single plot

2008-02-14 Thread John Kane
Perhaps matplot will do what you want? ?matplot aa <- matrix(1:25, nrow=5) matplot(aa) --- tomaschwutz <[EMAIL PROTECTED]> wrote: > How do a plot several columns of a matrix at once in > a single plot > versus a single x-variable? > > The default plot.matrix or plot.dataframe commands > plot ea

Re: [R] data frame question

2008-02-14 Thread John Kane
Create the new data.frame and do the muliplying on it? df2 <- df1 df2[,1] <- df2[,1]*2 --- joseph <[EMAIL PROTECTED]> wrote: > > > Hi > > I have a data frame df1 in which I would like to > multiply col1 > by 2. > > > The way I did it does not allow me to keep the old > data > frame. > > >

Re: [R] setting color ranges

2008-02-14 Thread hadley wickham
Hi Sam, You might find it easier to use ggplot2 to do this. See http://had.co.nz/ggplot2/geom_tile.html for some examples. Hadley On Thu, Feb 14, 2008 at 2:59 PM, samsr <[EMAIL PROTECTED]> wrote: > > Hi, > > I need to plot a matrix using image() such that negative values are easily > distin

Re: [R] non-interactive connection to SQL Server

2008-02-14 Thread Moshe Olshansky
Yes, it does - thank you! The only thing I forgot (and it took me a while to find this out) was to separate the fields by semicolon, i.e. the correct command is: odbcDriverConnect("driver=SQL Server; database=dataBaseName; wsid=myComputer; server=dataBaseServer; uid=moshe; pwd=moshe") --- Prof Br

Re: [R] finding source for a function

2008-02-14 Thread Gabor Csardi
RSiteSearch is your friend. E.g.: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/63365.html and then click on 'Next in thread a couple of times Gabor On Thu, Feb 14, 2008 at 03:23:30PM -0600, Edna Bell wrote: > Dear R Gurus: > > How do you get source for functions which say "UseMethod" wh

Re: [R] write output in a custom format

2008-02-14 Thread jim holtman
There is nothing wrong with a loop for handling this case. Most of your time is probably going to be spent writing out the files. If you don't want 'for' loops, you can use 'lapply', but I am not sure what type of "performance" improvement you will see. You are having to make decisions on each p

Re: [R] Principal component analysis PCA

2008-02-14 Thread Thomas Lumley
On Thu, 14 Feb 2008, SNN wrote: > > Thanks for the advice. > > I tried to find the cov of my matrix using R and it ran out of memory. How did you do this? The covariance matrix is only 115x115, so it shouldn't run out of memory cov(t(code)) should work If that doesn't work then tcrossprod

[R] finding source for a function

2008-02-14 Thread Edna Bell
Dear R Gurus: How do you get source for functions which say "UseMethod" when you type in their names, please? I've tried getAnywhere and getMethods...I thought that might produce them. Thanks in advance. Sincerely, Edna __ R-help@r-project.org mailin

Re: [R] write output in a custom format

2008-02-14 Thread baptiste Auguié
Thanks for the input! It does work fine, however I'll have to do another loop to repeat this whole process quite a few times (10^3, 10^4 particles maybe), so I was hoping for a solution without loop. Maybe I could reshape all the values into a big array, dump it to a file and replace some v

[R] setting color ranges

2008-02-14 Thread samsr
Hi, I need to plot a matrix using image() such that negative values are easily distinguishable from posittive values, while also maintaining a gradation in color with magnitude. How can I set ranges for colors in order to achieve this. Thanks. Sam -- View this message in context: http://www.n

Re: [R] Cholmod error `matrix not positive definite'

2008-02-14 Thread Douglas Bates
Could you tell us which version of the lme4 package you are using? You can just send the output produced by sessionInfo() If you can make your data available so we can test it then please do so. If the data set is large you could send it to me in private email and I will make it available on a w

[R] Using Conditional AIC with lmer

2008-02-14 Thread Kyle Edwards
Hi all, This was posted originally on r-sig-mixed-models, but I thought I would post here as well as it might be of more general interest. With a colleague, I have been trying to implement the Conditional AIC described by Vaida and Blanchard 2005 Biometrika, "Conditional Akaike information

Re: [R] deleting certain observations in a data frame

2008-02-14 Thread Peter Alspach
Karen For indices, use the minus sign: yourData[-indicesToBeDeleted,] For rownames, negate %in%: yourData[!rownames(yourData)%in%namesToBeDeleted,] HTH Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Chang Liu > Sent: Friday, 15 F

[R] deleting certain observations in a data frame

2008-02-14 Thread Chang Liu
Hi, I'm wondering what the fastest way is to delete certain data points (observations) in a data frame. I have a vector of the indices/row.names I would like to delete. I have tried replacing list by list, but it always complains about different lengths, "replacing list of length a with length

[R] Replacing columns in a data frame using a previous condition (SOLVED)

2008-02-14 Thread Jorge Iván Vélez
Dear R-list, Thanks a lot for your help. Thanks to Jim, Dimitris and Phil. It's exactly what I needed to do. Jorge On 2/14/08, Jorge Iván Vélez <[EMAIL PROTECTED]> wrote: > Dear R-list, > > I'm working with a data frame which dimensions are > > > dim(GERU) > [1] 3468 318 > > and looks like >

Re: [R] Replacing columns in a data frame using a previous condition

2008-02-14 Thread Jorge Iván Vélez
It's, Jim. Thank you so much. Jorge On 2/14/08, jim holtman <[EMAIL PROTECTED]> wrote: > > Is this what you want to do? > > > x <- data.frame(a=1:10, b=1:10, c=1:10, d=1:10) > > z <- cbind(c=11:20, d=11:20) > > z > c d > [1,] 11 11 > [2,] 12 12 > [3,] 13 13 > [4,] 14 14 > [5,] 15 15 > [6,

Re: [R] Replacing columns in a data frame using a previous condition

2008-02-14 Thread Dimitris Rizopoulos
try this: GERU[6:318] <- lapply(GERU[6:318], function (x) { if (length(unique(x[!is.na(x)])) >= 5) x[x == 2] <- 3 x }) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijn

Re: [R] Principal component analysis PCA

2008-02-14 Thread SNN
Thanks for the advice. I tried to find the cov of my matrix using R and it ran out of memory. I am not sure how to do double loop to create the covariace matrix? Also is doing prcomp( covariace matrix) the same as finding prcomp( original data ,matrix of snps)? Thanks for your help, Thomas

Re: [R] Replacing columns in a data frame using a previous condition

2008-02-14 Thread jim holtman
Is this what you want to do? > x <- data.frame(a=1:10, b=1:10, c=1:10, d=1:10) > z <- cbind(c=11:20, d=11:20) > z c d [1,] 11 11 [2,] 12 12 [3,] 13 13 [4,] 14 14 [5,] 15 15 [6,] 16 16 [7,] 17 17 [8,] 18 18 [9,] 19 19 [10,] 20 20 > x[,colnames(z)] <- z[, colnames(z)] > x a b

[R] Advice on analyzing a mixed effects survival model?

2008-02-14 Thread Kevin Crowston
Small correction: I meant to say that I had been reading: J. C. Pinheiro and D. M. Bates (2000), “Mixed-Effects Models in S and S-Plus”, Springer. Kevin Crowston __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

[R] Replacing columns in a data frame using a previous condition

2008-02-14 Thread Jorge Iván Vélez
Dear R-list, I'm working with a data frame which dimensions are > dim(GERU) [1] 3468 318 and looks like > GERU[1:10,1:10] ped ind par1 par2 sex sta rs7696470 rs7696470.1 rs1032896 rs1032896.1 1 USA5854 200 2 1 4 4 1 1 2 USA5854 3

[R] Advice on analyzing a mixed effects survival model?

2008-02-14 Thread Kevin Crowston
I have an experiment I'm trying to analyze that's turning out to be more complicated than I anticipated, so I was hoping for some suggestions about how to handle it. The lab experiment is a comparison between two search interfaces. After a little training, each subject performs 12 informati

Re: [R] Generalized nonlinear mixed model function?

2008-02-14 Thread Christian Ritz
Hi Philip, your data are event times because you're monitoring the same trees in each plot over time, the event being death of a tree. Therefore methods from survival analysis are more appropriate. Start out having a look at the package survival, possibly considering a Cox model with adjustment

Re: [R] data manipulation for plotting

2008-02-14 Thread Henrique Dallazuanna
Try this: values <- c(1,1,1,4,5,5,6) with(rle(values), plot(values, lengths)) But I think that you can use barplot: barplot(table(values)) On 14/02/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >Hi, > >i'd like to plot some data that I have with the value on the x axis and > fr

Re: [R] Transposing by a group variable

2008-02-14 Thread John Kane
How do we know what value corresponds to what new variable? library(reshape) mm <- melt(d, id="group") cast(mm, group~value) will give you something but not quite what you want. --- Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > Hi R, > > > > Can I transpose a data frame by a part

Re: [R] data manipulation for plotting

2008-02-14 Thread John Kane
Here are a couple of ways depending on what you want. data1=c(1,1,1,4,5,5,6) plot(table(data1)) --- plotvec <- as.vector(aa) nns <- names(aa) plot(plotvec, xaxt="n") mtext(nns, at=1:4, side=1) --- --- "[EMAIL PROTECTED]" <[EMA

Re: [R] Replacing a character string when finding substring match

2008-02-14 Thread Henrique Dallazuanna
Try this: x[grep("vehicle", x, ignore=T)] <- "Vehicle" On 14/02/2008, Judith Flores <[EMAIL PROTECTED]> wrote: > Dear R-experts, > > I need to replace the values of a vector(tx) with a > word ('Vehicle') when the value of the vector contains > the word 'vehicle'. Sometimes, the value could be

Re: [R] configure fails on new Redhat Enterprise System

2008-02-14 Thread Peter Dalgaard
[EMAIL PROTECTED] wrote: > Hello all, > > I have a new Redhat enterprise system that I'm trying to get set up with all > the goodies I need, including R-2.6.1. I got all of the required dependencies > including readline. However, configure dies with: > configure: error: --with-readline=yes (defau

[R] Replacing a character string when finding substring match

2008-02-14 Thread Judith Flores
Dear R-experts, I need to replace the values of a vector(tx) with a word ('Vehicle') when the value of the vector contains the word 'vehicle'. Sometimes, the value could be 'MCT vehicle', or 'control-vehicle', etc. I tried gsub like this treatment<-gsub('vehicle','Vehicle', tx, ignore.case=

Re: [R] fun.aggregate=mean in reshape

2008-02-14 Thread hadley wickham
> Of course your reasoning is clear and an in better knowledge about R > will help me to better interpret its error messages in the future. But > for an entry-level R user like me a conflict warning will be quite helpful. The next version of reshape should do better - I check whether fun.aggreg

Re: [R] apply on large arrays

2008-02-14 Thread Erich Neuwirth
> system.time({ + tab2 <- tab1 <- with(pisa1, table(CNT,GENDER,ISCOF,ISCOM)) + tab2[] <- 0 + tab2[which(tab1 == 1, arr.ind = TRUE)] <- 1 + tab3 <- rowSums(tab2) + }) user system elapsed 3.170.994.17 > > system.time({ + tab4 <- rowSums(tab1 == 1) + }) user system elapsed

[R] configure fails on new Redhat Enterprise System

2008-02-14 Thread Katherine.Gowan
Hello all, I have a new Redhat enterprise system that I'm trying to get set up with all the goodies I need, including R-2.6.1. I got all of the required dependencies including readline. However, configure dies with: configure: error: --with-readline=yes (default) and headers/libs are not availa

Re: [R] Generalized nonlinear mixed model function?

2008-02-14 Thread Ben Bolker
Phillip J van Mantgem usgs.gov> writes: > > I am wondering if there is an R function that could estimate a generalized > nonlinear mixed model. > Short answer: no (not really/not that I'm aware of). Long answer: AD Model Builder? WinBUGS? shortcuts like nlme applied to the proportion d

Re: [R] ks.test help

2008-02-14 Thread Prof Brian Ripley
On Thu, 14 Feb 2008, Uwe Ligges wrote: > > > Brian Flynn wrote: >> I am trying to do a ks.test in R 2.6.2 (running on Mac OS X 10.4.11). >> In the help guides it specifies that the y variable can be a >> character string for the type of distribution I want. I am doing this >> on the residuals of a

Re: [R] lm, coefficient 'not defined because of singularities'? What does this mean?

2008-02-14 Thread Prof Brian Ripley
Hint: x1 <- rep(pi, 283) y1 <- rnorm(283) summary(lm(y1 ~ x1)) More generally, see ?alias. The idea of singularity is a linear model is a statistical one, so it may be time to revisit your statistical education or read a good book on the subject (MASS comes to mind in this context). On Thu,

Re: [R] Package for Multiple Additive Regression Trees

2008-02-14 Thread Liaw, Andy
From: Hans W. Borchers > Christopher Schwalm umn.edu> writes: > > > > > Hello List, > > > > I've been unsuccessful in tracking down a package that does MART. J > > Friedman's website has a page that mentions an R > implementation but the > > links lead nowhere. There is also a nice walkthr

Re: [R] Kaplan Meier function

2008-02-14 Thread Frank E Harrell Jr
Matthias Gondan wrote: > Frank E Harrell Jr schrieb: >> Matthias Gondan wrote: data(colon) s = survfit(Surv(time, status) ~ rx, data=colon) plot(s) plot(s, col=1:3) >>> By the way: Does anyone know a neat way to indicate the number of >>> patients under risk in >>> the curve? >>

Re: [R] ks.test help

2008-02-14 Thread Uwe Ligges
Brian Flynn wrote: > I am trying to do a ks.test in R 2.6.2 (running on Mac OS X 10.4.11). > In the help guides it specifies that the y variable can be a > character string for the type of distribution I want. I am doing this > on the residuals of a regression model, but I continue to get a

[R] lm, coefficient 'not defined because of singularities'? What does this mean?

2008-02-14 Thread Martin Waller
Hello, I'm doing an lm(y1~x1), no NAs in them, both of length 283. I get out however and 'NA' for the estimate of x1 and summary gives: Residuals: Min 1Q Median 3Q Max -0.1998309 -0.0447269 -0.0006252 0.0390933 0.3141687 Coefficients: (1 not defined because of singulari

[R] ks.test help

2008-02-14 Thread Brian Flynn
I am trying to do a ks.test in R 2.6.2 (running on Mac OS X 10.4.11). In the help guides it specifies that the y variable can be a character string for the type of distribution I want. I am doing this on the residuals of a regression model, but I continue to get an error. This is some of th

Re: [R] data frame question

2008-02-14 Thread Stefan Grosse
On Thursday 14 February 2008 06:27:07 pm Stefan Grosse wrote: SG> df$col3<-df1$col1*2 ups it should be df1$col3<-df1$col1*2 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-

Re: [R] Problems with Rcmdr unter JGR (Windows XP)

2008-02-14 Thread Stefan Grosse
On Thursday 14 February 2008 06:12:11 pm Willi Nagl wrote: WN> I try to start Rmcdr from JGR. The Rmcdr-Windows comes up correctly; but WN> the WN> Menu-Bar in the Rcmdr-Window goes away, if I try to go into the WN> Rmcdr-Window. WN> WN> I hope, someone has a solution. WN> WN> Regards, willi WN>

Re: [R] data frame question

2008-02-14 Thread Stefan Grosse
On Thursday 14 February 2008 06:12:23 pm joseph wrote: jo> I have a data frame df1 in which I would like to multiply col1 jo> by 2. jo> The way I did it does not allow me to keep the old data jo> frame. jo> jo> jo> How can I do this and be able to create a new data frame jo> df2? jo> jo> jo> > df1$

Re: [R] plot matrix

2008-02-14 Thread jim holtman
transpose the matrix and then use 'matplot' On 2/14/08, Marek Bartkuhn <[EMAIL PROTECTED]> wrote: > Dear R users, > > > I like to plot a matrix A which looks like this: > > >,1 ,2 ,3 ,4 > > 1, 1 10 100 1000

[R] Problems with Rcmdr unter JGR (Windows XP)

2008-02-14 Thread Willi Nagl
I try to start Rmcdr from JGR. The Rmcdr-Windows comes up correctly; but the Menu-Bar in the Rcmdr-Window goes away, if I try to go into the Rmcdr-Window. I hope, someone has a solution. Regards, willi -- 0(049)753124283 privat 0(049)7531882641 büro [[alternative HTML version delete

Re: [R] data frame question

2008-02-14 Thread Henrique Dallazuanna
If I understand: df2 <- transform(df1, col3=col1*2) On 14/02/2008, joseph <[EMAIL PROTECTED]> wrote: > > > Hi > > I have a data frame df1 in which I would like to multiply col1 > by 2. > > > The way I did it does not allow me to keep the old data > frame. > > > How can I do this and be able

Re: [R] data frame question

2008-02-14 Thread Gabor Csardi
df2 = df ? G. On Thu, Feb 14, 2008 at 09:12:23AM -0800, joseph wrote: > > > Hi > > I have a data frame df1 in which I would like to multiply col1 > by 2. > > > The way I did it does not allow me to keep the old data > frame. > > > How can I do this and be able to create a new data frame

[R] data frame question

2008-02-14 Thread joseph
Hi I have a data frame df1 in which I would like to multiply col1 by 2. The way I did it does not allow me to keep the old data frame. How can I do this and be able to create a new data frame df2? > df1= data.frame(col1= c(3, 5, NA, 1), col2= c(4, NA,6, 2)) > df1 col1 col2 13

[R] plot matrix

2008-02-14 Thread Marek Bartkuhn
Dear R users, I like to plot a matrix A which looks like this: ,1 ,2 ,3 ,4 1, 1 10 100 1000 2, 0.5 0.2 1.0 4.3 3, 0.1 0.2 0.3

Re: [R] Levene's test for homogeneity of variances (befor using ANOVA)

2008-02-14 Thread Jorge Iván Vélez
Hi Kes, Try > library(help=car) > ?levene.test or "levene" in http://www.rseek.org/ (first hit). I hope this helps, Jorge On 2/14/08, Kes Knave <[EMAIL PROTECTED]> wrote: > > Dear all > > I have tried to find this function in R, but don't find it by searching in > the help function. > > Anyb

Re: [R] {lattice/grid} "Error using packet 1" and traceback

2008-02-14 Thread Deepayan Sarkar
On 2/14/08, Felix Andrews <[EMAIL PROTECTED]> wrote: > You can tell Lattice to stop when an error occurs, like this: > > lattice.options(panel.error="stop") > xyplot(1:10 ~ 1:10, panel=function(...) stop("foo")) > # -> Error in panel(x = 1:10, y = 1:10) : foo > > That is a little more informati

Re: [R] write output in a custom format

2008-02-14 Thread jim holtman
Here is a start. You basically have to interate through your data and use 'cat' to write it out: particle <- list(dose=c(1,100.0,0),pos=data.frame(x=c(0,1,0,1),y=c(0,1,0,1))) output <- file("/tempxx.txt", "w") cat(particle$dose, "\n", file=output, sep=" ") for (i in 1:nrow(particle$pos)){ cat

[R] Cholmod error `matrix not positive definite'

2008-02-14 Thread Martijn Vandegehuchte
Dear R-users, I'm new to R, so my apologies if this question doesn't make sense. I've tried the following model in lmer, and it works perfectly: model<-lmer(aphids~densroot+zone+(1|zone/site), family=quasipoisson) But if I try the exact same model with a different variable, totmas, the model lo

Re: [R] R equivalent of linux "cut", "paste", and "grep" ?

2008-02-14 Thread Greg Snow
Depending on what your final goal is, there may be a better approach, but to do as you state below, here is one set of options: 1) use read.csv (or read.table) and use the colClasses argument to specify keeping only column 5 2) use cbind to bind column 5 (now a data.frame) to another data.frame (p

Re: [R] Survival (KM/Cox) plots with lattice?

2008-02-14 Thread Dieter Menne
Deepayan Sarkar gmail.com> writes: > > I am looking for a lattice-panel for survival (KM/Cox) plots. I know it's > > not standard, but maybe someone has already tried? > > There are some half-formed ideas in > > http://dsarkar.fhcrc.org/talks/extendingLattice.pdf > > but nothing packaged (most

Re: [R] How to check cy5 and cy3 values were lowess normalized

2008-02-14 Thread Henrik Bengtsson
On Thu, Feb 14, 2008 at 4:57 AM, Ng Stanley <[EMAIL PROTECTED]> wrote: > Hi, > > I have some microarray data, cy5 and cy3 values are in log2. Is there a > way to check they have undergone lowess normalization ? Yes, go back ask the one who you got the data from. Honestly, this is a serious rep

[R] passing R array to Fortran subroutine

2008-02-14 Thread Timothy W. Hilton
Hello, I am trying to run a piece of Fortran code from R, and I am having trouble passing an array to the fortran subroutine. My attempts to pass an array into the fortran are producing memory errors, and I cannot find an example that performs the task. I have looked at "Writing R Extensions

Re: [R] plot each column of a matrix or dataframe versus x in a single plot

2008-02-14 Thread tomaschwutz
Thank you Dimitris, Jorge, and Mark (personal mail), for the hint to matplot and the examples. This was exactly what I was thinking of. Thomas __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

[R] write output in a custom format

2008-02-14 Thread baptiste Auguié
Hi, I need to create a text file in the following format, > 1 100.0 0 > 0 0 > 1 1 > 0 0 > 1 1 > # > 1 100.0 0 > 0 0 > 0 1 > 1 0 > 1 1 ... where # is part of the format and not a R comment. Each block (delimited by #) consists of a first line with three values, call it dose, and a lis

Re: [R] data manipulation for plotting

2008-02-14 Thread Abi Ghanem josephine
Hi rich, >data <- c(1,1,1,4,5,5,6) >table(data) data 1 4 5 6 3 1 2 1 hope it helps josephine [EMAIL PROTECTED] wrote: >Hi, > >i'd like to plot some data that I have with the value on the x axis and > freq >on the y axis. > >So, I need to calculate the freq a value is seen withi

Re: [R] Principal component analysis PCA

2008-02-14 Thread Thomas Lumley
On Wed, 13 Feb 2008, Wang, Zhaoming (NIH/NCI) [C] wrote: > > Try EIGENSTRAT http://www.nature.com/ng/journal/v38/n8/abs/ng1847.html The same approach as EIGENSTRAT is pretty straightforward in R. You need to create the covariance matrix of people (rather than of SNPs) for the 0/1/2 genotype at

Re: [R] plot each column of a matrix or dataframe versus x in a single plot

2008-02-14 Thread Jorge Iván Vélez
Hi Thomas, Ckeck ?matplot. Here's a simple example: # Data set x=runif(100)# Axis x1=rnorm(100,25,2) # Variable x_i x2=rnorm(100,10,1) x3=rnorm(100,15,4) x4=rnorm(100,30,4) DATA=cbind(x,x1,x2,x3,x4) # Plot matplot(x,DATA[,2:5],col=1:5,pch=1:5) I hope this helps.

Re: [R] {lattice/grid} "Error using packet 1" and traceback

2008-02-14 Thread Felix Andrews
You can tell Lattice to stop when an error occurs, like this: lattice.options(panel.error="stop") xyplot(1:10 ~ 1:10, panel=function(...) stop("foo")) # -> Error in panel(x = 1:10, y = 1:10) : foo That is a little more informative than the default "panel.error", because it tells you the condition

Re: [R] Transposing by a group variable

2008-02-14 Thread Henrique Dallazuanna
Try also: reshape(cbind(d, time=unlist(sapply(table(d$group), seq))), idvar="group", direction="wide") On 14/02/2008, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > Hi R, > > > > Can I transpose a data frame by a particular group variable? > > > > For example: > > d=data.frame(group=c(

Re: [R] Kaplan Meier function

2008-02-14 Thread Matthias Gondan
Frank E Harrell Jr schrieb: > Matthias Gondan wrote: >>> data(colon) >>> s = survfit(Surv(time, status) ~ rx, data=colon) >>> plot(s) >>> plot(s, col=1:3) >> >> By the way: Does anyone know a neat way to indicate the number of >> patients under risk in >> the curve? > That's one of many options in

Re: [R] plot each column of a matrix or dataframe versus x in a singleplot

2008-02-14 Thread Dimitris Rizopoulos
you could use the function matplot(), e.g., x <- 1:20 vals <- 2 + rep(1:5, each = 20) * rep(x, 5) + rnorm(100) dim(vals) <- c(20, 5) matplot(x, vals, type = "l", lty = 1) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catho

Re: [R] Error in model.frame.default: invalid type (list) for variable ...

2008-02-14 Thread Klaus (Diego)
I got it right now, It wasn't working because the matrix of predictors had the same name as the dataset, so I modified the call creating a dataset with the response and predictors and keeping the data.frame using the same name metodocentrod <- data.frame(metodocentro) resultadocentro <- glm(Ycent

Re: [R] Levene's test for homogeneity of variances (befor using ANOVA)

2008-02-14 Thread David Whiting
On Thu, Feb 14, 2008 at 03:47:35PM +0100, Kes Knave wrote: > Dear all > > I have tried to find this function in R, but don't find it by searching in > the help function. Take a look at in R: ?RSiteSearch Use this to search for it. > > Anybody who knows if R has the function "Levene's test for

Re: [R] Levene's test for homogeneity of variances (befor using ANOVA)

2008-02-14 Thread Chuck Cleland
On 2/14/2008 9:47 AM, Kes Knave wrote: > Dear all > > I have tried to find this function in R, but don't find it by searching in > the help function. > > Anybody who knows if R has the function "Levene's test for homogeneity of > variances"? > > Note: Im a "R-begginer" I wonder how you searc

[R] plot each column of a matrix or dataframe versus x in a single plot

2008-02-14 Thread tomaschwutz
How do a plot several columns of a matrix at once in a single plot versus a single x-variable? The default plot.matrix or plot.dataframe commands plot each column versus each other column in several sub-plots. I want to plot each column versus a single other vector (x) as several lines or points

Re: [R] Levene's test for homogeneity of variances (befor using ANOVA)

2008-02-14 Thread Gavin Simpson
On Thu, 2008-02-14 at 15:47 +0100, Kes Knave wrote: > Dear all > > I have tried to find this function in R, but don't find it by searching in > the help function. > > Anybody who knows if R has the function "Levene's test for homogeneity of > variances"? results 1 & 2 of: RSiteSearch("Levene's"

[R] RFC for package PopCon: a popularity contest for R and packages

2008-02-14 Thread Jeffrey Horner
(I posted this to the R-devel list yesterday, but I thought others on this list would be interested, so sorry for those who get it twice.) Hello all, I've developed a prototype package called PopCon (short for popularity contest), a package for tracking the popularity of R and its packages. I'

Re: [R] Modelling disease spread

2008-02-14 Thread francogrex
Thanks Marcel, In addition to your program and the reference to "simecol", someone had replied to my private email pointing out "RLadyBug": An R package for stochastic epidemic models which is on CRAN and which seems one of the most relevant. I write it here as a reference for users doing a future

Re: [R] Kaplan Meier function

2008-02-14 Thread Frank E Harrell Jr
Matthias Gondan wrote: > Hi Eleni, hi list, > > here is small sample program, the library is "survival", it is included > in the standard R distribution. > >> data(colon) >> s = survfit(Surv(time, status) ~ rx, data=colon) >> plot(s) >> plot(s, col=1:3) > > By the way: Does anyone know a neat wa

Re: [R] data manipulation for plotting

2008-02-14 Thread Gavin Simpson
On Thu, 2008-02-14 at 14:35 +, [EMAIL PROTECTED] wrote: > Hi, > >i'd like to plot some data that I have with the value on the x axis and > freq >on the y axis. > >So, I need to calculate the freq a value is seen within my data vector > >for example, say i have a vector of d

[R] Levene's test for homogeneity of variances (befor using ANOVA)

2008-02-14 Thread Kes Knave
Dear all I have tried to find this function in R, but don't find it by searching in the help function. Anybody who knows if R has the function "Levene's test for homogeneity of variances"? Note: Im a "R-begginer" Regards Kes [[alternative HTML version deleted]] ___

Re: [R] Transposing by a group variable

2008-02-14 Thread Dimitris Rizopoulos
try this: d <- data.frame(group = c(1,1,2,2,2), val = c(6,4,6,3,5)) d$time <- unlist(tapply(d$group, d$group, function (x) seq(1, len = length(x reshape(d, idvar = "group", direction = "wide") I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre

Re: [R] Kaplan Meier function

2008-02-14 Thread Matthias Gondan
Hi Eleni, hi list, here is small sample program, the library is "survival", it is included in the standard R distribution. > data(colon) > s = survfit(Surv(time, status) ~ rx, data=colon) > plot(s) > plot(s, col=1:3) By the way: Does anyone know a neat way to indicate the number of patients unde

  1   2   >