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

2008-02-14 Thread Ng Stanley
Hi, What functions should I use in order to perform the following steps: 1) Load a particular column (e.g., column 5) from a csv file 2) Append the column 5 to another csv file 3) select those rows that match specific keywords in column 5 [[alternative HTML version deleted]]

[R] shaded area graph and extra plot

2008-02-14 Thread Luis Ridao Cruz
R-help, I'm using the code below to plot a shaded area graph. At the same time I want to plot a second series on the y-axis (from par(new=T) on) but as the two series have different x-axis range (first 1994:2007 and second 1996:2007) the corresponding x's do not match. How can this be sorted

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

2008-02-14 Thread Romain Francois
Hi, If you are on a linux system, you can use these linux commands through pipe. Otherwise : - perl would do a great job on this. - if you are familiar enough with SQL syntax, you can use the development version of the sqldf package to work on csv files as if they were database tables. See

Re: [R] Does the t.test in R uses Welch procedure or ordinary student t-test?

2008-02-14 Thread Gavin Simpson
On Thu, 2008-02-14 at 11:51 +0100, Kes Knave wrote: Dear all I have run t.test(), and get a output similar to this: t.test(extra ~ group, data = sleep) Welch Two Sample t-test ^ Pretty big hint don't you think? data: extra by group t = -1.8608, df = 17.776,

[R] Any mountain clustering method in R?

2008-02-14 Thread Josep Maria Campanera Alsina
Dear all, I wonder which R algorithm could perform a mountain clustering in an spatial grid, in other words, having the coordinates of a map (x,y ... or even more) and then the altitude/height at each point I would like to localise the peaks of that topological surface. Which R algorithm can

[R] contingency table

2008-02-14 Thread Carla Rebelo
Hello! May you help me? I'm trying to do a contingency table using this data(iris) library(rpart) modelo - rpart(Species ~., iris) prev - predict(modelo, iris) Finally the contingency table table(iris$Species, prev) But an error occurs: Error in table(iris$Species, prev) : all

Re: [R] contingency table

2008-02-14 Thread Henrique Dallazuanna
I don't know if this you want but, you can try: table(data.frame(prev, iris$Species)) On 14/02/2008, Carla Rebelo [EMAIL PROTECTED] wrote: Hello! May you help me? I'm trying to do a contingency table using this data(iris) library(rpart) modelo - rpart(Species ~., iris) prev

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

2008-02-14 Thread Ng Stanley
Hi, I have some microarray data, cy5 and cy3 values are in log2. Is there a way to check they have undergone lowess normalization ? Thanks Stanley [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] Random termination of R with RODBC and PostgreSQL 8.2.6

2008-02-14 Thread Ulrich Leopold
Dear list, I get random terminations of R when using RODBC with a remote PostgreSQL 8.2.6 database under Ubuntu Linux 7.10 32bit client. The exact messages can be seen below. It seems that there is some memory corruption going on. But it seems random to me and can neither be related to addPK=T/F

[R] Removing columns that are all NA from a matrix

2008-02-14 Thread Martin Waller
Hi, I guess this might be a FAQ or something, and there's probably a nice simple way to do it, but I can't think of it: Given a matrix, I want to remove columns that are _entirely_ filled with NAs (partial NAs are fine). How please? Thanks, Martin

Re: [R] Removing columns that are all NA from a matrix

2008-02-14 Thread Gabor Csardi
data - data[ , !apply(is.na(data), 2, all)] (or something like that) G. On Thu, Feb 14, 2008 at 12:59:46PM +, Martin Waller wrote: Hi, I guess this might be a FAQ or something, and there's probably a nice simple way to do it, but I can't think of it: Given a matrix, I want to

Re: [R] contingency table

2008-02-14 Thread Prof Brian Ripley
Try looking at 'prev' (it is a matrix) and then reading ?predict.rpart to see why. My guess is that you intended type=class. On Thu, 14 Feb 2008, Carla Rebelo wrote: Hello! May you help me? I'm trying to do a contingency table using this data(iris) library(rpart) modelo -

Re: [R] Removing columns that are all NA from a matrix

2008-02-14 Thread Chuck Cleland
On 2/14/2008 7:59 AM, Martin Waller wrote: Hi, I guess this might be a FAQ or something, and there's probably a nice simple way to do it, but I can't think of it: Given a matrix, I want to remove columns that are _entirely_ filled with NAs (partial NAs are fine). How please?

Re: [R] Removing columns that are all NA from a matrix

2008-02-14 Thread Dimitris Rizopoulos
try this: mat - matrix(rnorm(42), 6, 7) mat[sample(42, 10)] - NA mat[, c(3,5)] - NA ind - colSums(is.na(mat)) != nrow(mat) mat mat[, ind] I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven

Re: [R] Removing columns that are all NA from a matrix

2008-02-14 Thread Ted Harding
On 14-Feb-08 12:59:46, Martin Waller wrote: Hi, I guess this might be a FAQ or something, and there's probably a nice simple way to do it, but I can't think of it: Given a matrix, I want to remove columns that are _entirely_ filled with NAs (partial NAs are fine). How please? Thanks,

[R] Question: about loading a new package

2008-02-14 Thread Stefano Sofia
I am using R Version 2.3.1 (2006-06-01) in Linux with Ubuntu 7.4. I installed a new package with R CMD INSTALL -l /usr/lib/R/library newpackage.tar.gz Each time I run R I need to load this new package typing library(newpackage). My question is: how can I automatically load this new package

[R] (RESOLVED) Re: Removing columns that are all NA from a matrix

2008-02-14 Thread Martin Waller
Thanks to all who responded - great stuff! Martin Martin Waller wrote: Hi, I guess this might be a FAQ or something, and there's probably a nice simple way to do it, but I can't think of it: Given a matrix, I want to remove columns that are _entirely_ filled with NAs (partial NAs are

Re: [R] Question: about loading a new package

2008-02-14 Thread Ted Harding
On 14-Feb-08 13:23:17, Stefano Sofia wrote: I am using R Version 2.3.1 (2006-06-01) in Linux with Ubuntu 7.4. I installed a new package with R CMD INSTALL -l /usr/lib/R/library newpackage.tar.gz Each time I run R I need to load this new package typing library(newpackage). My question

Re: [R] Tinn-R not working well with latest R

2008-02-14 Thread Philippe Grosjean
Hello, These are *warnings*. So, the functions should still work. However, there are changes made in R that probably need some lifting in the svIDE package. The whole SciViews bundle is currently reworked. Unfortunately, I now work on Mac OS X, and it is a little bit more difficult for me to

[R] Analysis with spatstat and Kcross() requires to much memory

2008-02-14 Thread Rainer M Krug
Hi I am running analysis with Kcross from the package spatstat and I am getting a message that R can not allocate enough memory for a vector of 900MB. R seems to be running towards the 2GB limit per process. The dataset is not to big (ca 3000 points) but the mask for the points is extremely

[R] Kaplan Meier function

2008-02-14 Thread Eleni Christodoulou
Hi all, I am trying to draw a Kaplan-Meier curve and I found online that Kaplan - Meier estimates are computed with a function called km in the event package. Is there an update for that because when I choose to download packages in R,. there is no package called event, even though I have

Re: [R] Kaplan Meier function

2008-02-14 Thread Kevin E. Thorpe
See the survfit() in the survival package which is one on the recommended packages that should (I think) have come with R. Eleni Christodoulou wrote: Hi all, I am trying to draw a Kaplan-Meier curve and I found online that Kaplan - Meier estimates are computed with a function called km in

Re: [R] Kaplan Meier function

2008-02-14 Thread Dieter Menne
Eleni Christodoulou elenichri at gmail.com writes: I am trying to draw a Kaplan-Meier curve and I found online that Kaplan - Meier estimates are computed with a function called km in the event package. Is there an update for that because when I choose to download packages in R,. there is no

Re: [R] Any mountain clustering method in R?

2008-02-14 Thread Ramon Diaz-Uriarte
Dear Josep Maria, Maybe this is way too naive, but what about a hill-climbing algorithm started from different places, and without (almost) any attempt to avoid local maxima? I think that if you formulate your question like a clustering problem, then you'll be using techniques that attempt to

Re: [R] Kaplan Meier function

2008-02-14 Thread Dimitris Rizopoulos
check function survfit() in package survival. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web:

[R] Transposing by a group variable

2008-02-14 Thread Shubha Vishwanath Karanth
Hi R, Can I transpose a data frame by a particular group variable? For example: d=data.frame(group=c(1,1,2,2,2),val=c(6,4,6,3,5)) And my output should be: data.frame(group=c(1,2),v1=c(6,6),v2=c(4,3),v3=c(NA,5)) Many thanks, Shubha This e-mail may contain confidential and/or

Re: [R] Kaplan Meier function

2008-02-14 Thread Eleni Christodoulou
Thank you all for the replies! Eleni On Thu, Feb 14, 2008 at 4:10 PM, Dimitris Rizopoulos [EMAIL PROTECTED] wrote: check function survfit() in package survival. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of

Re: [R] User defined split function in Rpart

2008-02-14 Thread Terry Therneau
The question is about the direction vector in rpart. There are (at least) two preferred ways to lay out a tree, wrt the question of which obs are sent left and which right. 1. Send the smaller y values to the left. In the final tree, there will be a graphical ordering with

[R] data manipulation for plotting

2008-02-14 Thread [EMAIL PROTECTED]
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 data data=c(1,1,1,4,5,5,6) I want values-c(1,4,5,6)

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 under

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

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

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 way to indicate

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

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

[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 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 searched for a

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

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 Catholic

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:

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 conditionCall

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] 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 within my data

[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 list of (x,y)

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

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

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 reply,

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)){

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 informative than the

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. Anybody who

[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

[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

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

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 'MCT

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

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

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

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

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 freq

[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

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 particular

[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

[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

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

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

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 c d 1

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,

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

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 when

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

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

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

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

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

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

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

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

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. How can I do this

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 each

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 that

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

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, and this

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.org

[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

[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 and 2.

[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

[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

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

2008-02-14 Thread Michael Bibo
Willi Nagl willi.nagl at 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

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

[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

[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

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,

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 should be

[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

  1   2   >