[R] format

2010-01-30 Thread Zhongyi Yuan
Hi, Could anybody please help me with this? In the following function, I try to return a good format of x, i.e. if my x[1] is 800, I don't want it to give me 800.0. I tried format(x, trim = TRUE), but didn't work. If my x has only first three components, which are all integers, I don't run into th

Re: [R] Solving an optimization problem: selecting an "optimal" subset

2010-01-30 Thread Erwin Kalvelagen
Dimitri Shvorob gmail.com> writes: > > > ?!! Erwin, may I ask for a working code sample? (Including appropriate > package(s)) > > Thank you. I used GAMS + CPlex. The models are here: http://yetanothermathprogrammingconsultant.blogspot.com/2010/01/solving- optimization-problem-selecting.html

Re: [R] Running a Logit Model in R

2010-01-30 Thread David Winsemius
On Jan 30, 2010, at 8:24 PM, Mathew, Abraham T wrote: I'm an R newbie and had the following question. I'm trying to run a logit model because I have a dependant variable that is a factor with three levels. Each of my independent variables are factor variables and have two or more levels,

Re: [R] Solving an optimization problem: selecting an "optimal" subset

2010-01-30 Thread Dimitri Shvorob
Same request to Hans: I am afraid I need a little more spoon-feeding following > I sent a GAMS script modeling this problem to the NEOS solvers Thanks a lot! -- View this message in context: http://n4.nabble.com/Solving-an-optimization-problem-selecting-an-optimal-subset-tp1446084p1457747.htm

Re: [R] Solving an optimization problem: selecting an "optimal" subset

2010-01-30 Thread Dimitri Shvorob
?!! Erwin, may I ask for a working code sample? (Including appropriate package(s)) Thank you. -- View this message in context: http://n4.nabble.com/Solving-an-optimization-problem-selecting-an-optimal-subset-tp1446084p1457746.html Sent from the R help mailing list archive at Nabble.com. __

[R] Running a Logit Model in R

2010-01-30 Thread Mathew, Abraham T
I'm an R newbie and had the following question. I'm trying to run a logit model because I have a dependant variable that is a factor with three levels. Each of my independent variables are factor variables and have two or more levels, which is why I'm unsure about the error. regone <- glm(da

Re: [R] aggregate by factor

2010-01-30 Thread Dennis Murphy
Hi: You could complete the entire process in one shot with the plyr package, using function ddply. Using the piece of data supplied, > ddply(motifList, .(events), summarize, freq = length(events), score = median(score)) events freq score 1 aehjm1 0.0833 2 aeijm2 -0.2500

Re: [R] "should be" easy data frame manipulation

2010-01-30 Thread David Winsemius
On Jan 30, 2010, at 4:38 PM, Brad Patrick Schneid wrote: You rock! thank you.. you saved me hours of hunting around. -- You should read the r-help list more often. Gabor Grothendieck gave an example of the use of xtabs() this very morning. David Winsemius, MD Heritage Laboratories Wes

Re: [R] Barplot/Histogram (lattice)

2010-01-30 Thread Deepayan Sarkar
On Thu, Jan 28, 2010 at 8:59 PM, Santosh wrote: > Dear Rxperts.. > > what settings in barplot and histogram do I use, to show bars in an > monotonously increasing or decreasing order of the frequency of a > categorical variable? See ?reorder. Typical usage would be (in lattice) barchart(y ~ reor

[R] accessing column and row numbers inside splom in lattice

2010-01-30 Thread Roger Levy
Hi, When using splom() in the lattice package, I would like to be able to access the row and column number of each individual pairs plot , similar to the way that current.row() and current.column() can be used in other lattice plotting functions such as xyplot. For example, I would like

Re: [R] help on Venn's diagram

2010-01-30 Thread Jorge Ivan Velez
Gabriele, Take a look at this: http://research.stowers-institute.org/efg/R/Math/VennDiagram.htm Best, Jorge On Sat, Jan 30, 2010 at 10:13 PM, Zoppoli, Gabriele (NIH/NCI) [G] <> wrote: > Hello! > > I have this problem: I want to create a Venn's diagram with three lists of > genes'names. The fir

[R] help on Venn's diagram

2010-01-30 Thread Zoppoli, Gabriele (NIH/NCI) [G]
Hello! I have this problem: I want to create a Venn's diagram with three lists of genes'names. The first is all the genome, the second a subset of it comprising all mitochondrial genes, and the third including all genes that correlate with a given gene. This is what I do: > library(gplots) >

Re: [R] lmer, mcmcsamp, coda, HPDinterval

2010-01-30 Thread Gabor Grothendieck
Detach the coda library. Its HPDinterval is conflicting with the HPDinterval in lme4. You should have gotten a warning message about the conflict when you tried to load coda. On Sat, Jan 30, 2010 at 9:34 PM, Doug Adams wrote: > > Hi, > > I've got a linear mixed model created using lmer: > > A6m

[R] lmer, mcmcsamp, coda, HPDinterval

2010-01-30 Thread Doug Adams
Hi, I've got a linear mixed model created using lmer: A6mlm <- lmer(Score ~ division + (1|school), data=Age6m) (To those of you to whom this model looks familiar, thanks for your patience with this & my other questions.) Anyway, I was trying this to look at the significance of my fixed effects

Re: [R] pca in R

2010-01-30 Thread Ista Zahn
I've found the functions in the psych package easier to use than the built in functions for principal components analysis. -Ista On Sat, Jan 30, 2010 at 2:09 PM, ogbos okike wrote: > Hi, > I am learning how to do principal component analysis in R. However, since I > am family with only a few bui

Re: [R] shared object location

2010-01-30 Thread Murat Tasan
as a motivating example, consider the case where multiple/many R packages are being developed that all use the same shared object functions. each time (during development) that the shared object file changes we could go alter every single R package directory, or simply have the R package utilize t

[R] importing ISI Web of Science citation data

2010-01-30 Thread Nick Urban
Hello, I'm a programmer, but brand new to R. I want to create a citation network using data from ISI Web of Science. Are there any libraries out there to assist with this process? Thanks, Nick [[alternative HTML version deleted]] __ R-help@r

[R] iterative regressions, adding a new line of data each time

2010-01-30 Thread ace834
Hi, I am pretty new to R. I'm trying run a regression repeatedly, adding a new data point each time, and then storing the predicted Y values. For example, let's say I have 500 data points and I run the regression. I would then like to store the Y value, run the regression again using 501 data poin

Re: [R] "should be" easy data frame manipulation

2010-01-30 Thread Brad Patrick Schneid
You rock! thank you.. you saved me hours of hunting around. -- View this message in context: http://n4.nabble.com/should-be-easy-data-frame-manipulation-tp1457518p1457675.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-projec

Re: [R] Applying a transformation to multiple data frame columns

2010-01-30 Thread Brad Patrick Schneid
look at plyr package colwise (column wise) function -- View this message in context: http://n4.nabble.com/Applying-a-transformation-to-multiple-data-frame-columns-tp1457641p1457666.html Sent from the R help mailing list archive at Nabble.com. __ R-hel

Re: [R] Applying a transformation to multiple data frame columns

2010-01-30 Thread jim holtman
for (i in c('aum', 'num','aum.core','num.core')) t[[i]][is.na(t[[i]])] <- 0 On Sat, Jan 30, 2010 at 3:34 PM, Dimitri Shvorob wrote: > > How can one simplify the folowing? > > t$aum[is.na(t$aum)] = 0; t$aum.core[is.na(t$aum.core)] = 0 > t$num[is.na(t$num)] = 0; t$num.core[is.na(t$num.core)] = 0 >

Re: [R] Sweave - have Sexpr print 3 digits when the last is 0

2010-01-30 Thread Jorge Ivan Velez
Hi Elizabeth, Try using sprintf (?sprintf) instead of round(). HTH, Jorge On Sat, Jan 30, 2010 at 5:50 PM, Elizabeth Stanny <> wrote: > Hi, > > I want 3 digits printed even if the last one is zero with \Sexpr{} > > For example: > > ghg.06[12] > [1] 0.2501008 > > I want: 0.250 > > What I've tri

Re: [R] Solving an optimization problem: selecting an "optimal" subset

2010-01-30 Thread Hans W Borchers
Dimitri Shvorob gmail.com> writes: > > > This is a "subset sum" problem and has been discussed here in December > > Thanks a lot! Will investigate. > > > Can you settle for an approximate solution? > > Absolutely. You can use the script from the thread "subset sum problem" to find approxima

Re: [R] DRAW TWO REGRESSION CURVES IN ONE GRAPH

2010-01-30 Thread Gabor Grothendieck
On Sat, Jan 30, 2010 at 12:39 PM, ATANU wrote: > how can i draw two regression curves in one graph??i can draw them seperately > using scatter.smooth.but can"t adjust them in one single graph Using the built in iris data frame: library(lattice) xyplot(Sepal.Length ~ Sepal.Width, iris, group = ir

Re: [R] Solving an optimization problem: selecting an "optimal" subset

2010-01-30 Thread Erwin Kalvelagen
Dimitri Shvorob gmail.com> writes: > > > A 40-element subset proves too much :( > > > Error: cannot allocate vector of size 554.1 Mb > > Thanks, Bart! I could solve a problem with n=200, k=40 with Cplex's MIQP solver in less than a minute, but that may depend heavily on the data. The mode

Re: [R] shared object location

2010-01-30 Thread Murat Tasan
The primary reason is for development. I do install via the traditional R CMD INSTALL (or variant) method, but I want to keep the C code external from the R package. In particular, I want to be able to modify the C code (and thus the compiled .so library functions) without having to constantly re-

[R] Sweave - have Sexpr print 3 digits when the last is 0

2010-01-30 Thread Elizabeth Stanny
Hi, I want 3 digits printed even if the last one is zero with \Sexpr{} For example: > ghg.06[12] [1] 0.2501008 I want: 0.250 What I've tried: \Sexpr{round(ghg.06[12],3)} 0.25 \Sexpr{format(ghg.06[12])} % set options(digits=3) in earlier rnw chunk 0.25 \Sexpr{round(ghg.06[12],4} %but I want

Re: [R] aggregate by factor

2010-01-30 Thread David Winsemius
On Jan 30, 2010, at 4:46 PM, david hilton shanabrook wrote: On 30 Jan 2010, at 4:20 PM, David Winsemius wrote: On Jan 30, 2010, at 4:09 PM, david hilton shanabrook wrote: I have a data frame with two columns, a factor and a numeric. I want to create data frame with the factor, its frequ

Re: [R] MA parameter in R vs. Minitab

2010-01-30 Thread Turner Rolf
Erin Hodgess wrote: Dear R People: I ran an ARIMA(1,0,1) on a particular series in R and got a negative MA(1) estimate. Then I ran an ARIMA(1,0,1) on the same series in Minitab and got a positive MA(1) estimate. The values are about -0.69 and 0.70. Does R show the opposite value, please? Uh,

Re: [R] More than on loop??

2010-01-30 Thread jim holtman
Also this looks like homework, so I can not really reply with a solution. BTW, once you have the normalized matrix, barplot will create your output without the complications of steps 8-13. You will have to use the data to put the text, but that again is relatively easy with the data. On Sat, Jan

Re: [R] aggregate by factor

2010-01-30 Thread david hilton shanabrook
On 30 Jan 2010, at 4:20 PM, David Winsemius wrote: > > On Jan 30, 2010, at 4:09 PM, david hilton shanabrook wrote: > >> I have a data frame with two columns, a factor and a numeric. I want to >> create data frame with the factor, its frequency and the median of the >> numeric column >>> head

Re: [R] More than on loop??

2010-01-30 Thread jim holtman
One quick comment about looking at the graphs you provided, why aren't all 8 columns the same height given that each column should have the same number of amino acids in them. FOr the cleaved case is it 114 and even after normalizing, the column sums should be the same -- 100. Are the graphs real

[R] MA parameter in R vs. Minitab

2010-01-30 Thread Erin Hodgess
Dear R People: I ran an ARIMA(1,0,1) on a particular series in R and got a negative MA(1) estimate. Then I ran an ARIMA(1,0,1) on the same series in Minitab and got a positive MA(1) estimate. The values are about -0.69 and 0.70. Does R show the opposite value, please? Thanks, Erin -- Erin H

Re: [R] "should be" easy data frame manipulation

2010-01-30 Thread David Winsemius
On Jan 30, 2010, at 12:00 PM, Brad Patrick Schneid wrote: I have a data.frame with the following: ID Species Count 1 A 3 1 B 2 1 E 12 2 A 13 2 C 5 2 F 4 3

Re: [R] aggregate by factor

2010-01-30 Thread David Winsemius
On Jan 30, 2010, at 4:09 PM, david hilton shanabrook wrote: I have a data frame with two columns, a factor and a numeric. I want to create data frame with the factor, its frequency and the median of the numeric column head(motifList) events score 1 aeijm -0.2500 2 begjm -0.2500

Re: [R] Using auto.key with two variable plots

2010-01-30 Thread Chuck Cleland
On 1/30/2010 3:45 PM, Jonathan Greenberg wrote: > Rhelpers: > >Having a problem solving this. I have an xyplot call that looks like > this: > > > print(xyplot(temp_species_EAM_Pred_Pop$x+temp_species_NULL_Pred_Pop$x~temp_species_EAM_Pred_Pop$Action,main=current_species, > >

[R] aggregate by factor

2010-01-30 Thread david hilton shanabrook
I have a data frame with two columns, a factor and a numeric. I want to create data frame with the factor, its frequency and the median of the numeric column > head(motifList) events score 1 aeijm -0.2500 2 begjm -0.2500 3 afgjm -0.2500 4 afhjm -0.2500 5 aeijm -0.25

Re: [R] Solving an optimization problem: selecting an "optimal" subset

2010-01-30 Thread Dimitri Shvorob
A 40-element subset proves too much :( > Error: cannot allocate vector of size 554.1 Mb Thanks, Bart! -- View this message in context: http://n4.nabble.com/Solving-an-optimization-problem-selecting-an-optimal-subset-tp1446084p1457597.html Sent from the R help mailing list archive at Nabble.com

[R] [R-pkgs] exactci package gives exact binomial and poisson tests and matching CI

2010-01-30 Thread Fay, Michael (NIH/NIAID) [E]
I am announcing the release of the exactci package. It calculates exact tests and confidence intervals for binomial and Poisson tests. Here is an example to motivate the package: Suppose you want to see if the observed rates of 2/17877 for group A are significantly different from the observe

[R] "should be" easy data frame manipulation

2010-01-30 Thread Brad Patrick Schneid
I have a data.frame with the following: ID Species Count 1 A 3 1 B 2 1 E 12 2 A 13 2 C 5 2 F 4 3 B 5 3 D 3 I need it in thi

[R] [R-pkgs] Update to exact2x2 package: Exact McNemar's test

2010-01-30 Thread Fay, Michael (NIH/NIAID) [E]
Hi all, I have updated the exact2x2 package which calculates exact conditional tests and the matching confidence intervals for 2x2 tables. The big change in the update is to allow the option paired=TRUE which gives an exact McNemar's test together with odds ratio estimates and confidence inter

[R] Applying a transformation to multiple data frame columns

2010-01-30 Thread Dimitri Shvorob
How can one simplify the folowing? t$aum[is.na(t$aum)] = 0; t$aum.core[is.na(t$aum.core)] = 0 t$num[is.na(t$num)] = 0; t$num.core[is.na(t$num.core)] = 0 Thank you. -- View this message in context: http://n4.nabble.com/Applying-a-transformation-to-multiple-data-frame-columns-tp1457641p1457641.h

[R] DRAW TWO REGRESSION CURVES IN ONE GRAPH

2010-01-30 Thread ATANU
how can i draw two regression curves in one graph??i can draw them seperately using scatter.smooth.but can"t adjust them in one single graph -- View this message in context: http://n4.nabble.com/DRAW-TWO-REGRESSION-CURVES-IN-ONE-GRAPH-tp1457544p1457544.html Sent from the R help mailing list arch

Re: [R] Using auto.key with two variable plots

2010-01-30 Thread Dylan Beaudette
On Sat, Jan 30, 2010 at 12:45 PM, Jonathan Greenberg wrote: > Rhelpers: > >   Having a problem solving this.  I have an xyplot call that looks like > this: > > > print(xyplot(temp_species_EAM_Pred_Pop$x+temp_species_NULL_Pred_Pop$x~temp_species_EAM_Pred_Pop$Action,main=current_species, >          

[R] Using auto.key with two variable plots

2010-01-30 Thread Jonathan Greenberg
Rhelpers: Having a problem solving this. I have an xyplot call that looks like this: print(xyplot(temp_species_EAM_Pred_Pop$x+temp_species_NULL_Pred_Pop$x~temp_species_EAM_Pred_Pop$Action,main=current_species, xlab="Action",ylab="Predicted Pop",

Re: [R] More than on loop??

2010-01-30 Thread che
Here is the the written instruction as i managed to get it from my professor, the graphs and data are attached: The graph below shows an example of the expected outcome of this course work. You may procude a better one. The graph for analysing the motifs of a set of peptides is designed this way

Re: [R] graph help

2010-01-30 Thread Bryan Hanson
Robyn, I've found this page helpful in understand the details of the kinds of plots you want to make: http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/index.ht m but in general, if your subplots are related to each other, you should probably switch from base graphics to the latt

Re: [R] For loop into a vectorized form?

2010-01-30 Thread David Winsemius
On Jan 29, 2010, at 9:31 AM, johannes rara wrote: How to vectorize this for loop and how can I assign result to vector instead of using print function? > as.vector( sapply(mylist$a, function(x) sapply(mylist$b, function (y) { c

Re: [R] More than on loop??

2010-01-30 Thread jim holtman
It is not entirely clear what you are trying to do. Can you explain what the matrix that you are creating out of 'cleaved' represents? "Tell me what you want to do; not how you want to do it". It is hard to follow code when you have not explained what it is doing. THere appear to be all kinds o

[R] graph help

2010-01-30 Thread Rob Manley
Hello, I'm fairly new to R and having trouble displaying my data graphically to a publishable quality. I have a multivariate data-set (columns all the same length), 8 environmental variables and 3 species diversity variables. I'm simply trying to display bivariate plots of the environmental variab

Re: [R] function to create multiple lists

2010-01-30 Thread Patrick Connolly
On Fri, 29-Jan-2010 at 03:16PM -0800, Cat Morning wrote: |> Hi all, |> I want to write a function to create multiple lists (over 100 |> lists). For example: Could it be that you want to create multiple vectors? That's what it looks like to me. If your question is clear, the answer probably wil

Re: [R] convert data frame of values into correlation matrix

2010-01-30 Thread Gabor Grothendieck
Try his: xtabs(corrs ~., myData) On Sat, Jan 30, 2010 at 2:11 PM, Juliet Hannah wrote: > Hi Group, > > Consider a data frame like this: > > mylabel1 <- rep(c("A","B","C"),each=3) > mylabel2 <- rep(c("A","B","C"),3) > corrs <- c(1,.8,.7,.8,1,.7,.7,.7,1) >  myData <- data.frame(mylabel1,mylabel2,

Re: [R] For loop into a vectorized form?

2010-01-30 Thread jim holtman
Is this what you want: > mylist <- list(a = letters[1:3], b = LETTERS[1:3], c = c("1", "2", "3")) > > x <- expand.grid(seq(length(mylist$a)), seq(length(mylist$b))) > result <- apply(x, 1, function(.row){ + list(mylist[[1]][.row[1]], mylist[[2]][.row[2]], mylist[[3]]) + }) > > result [[1]] [[1

Re: [R] convert data frame of values into correlation matrix

2010-01-30 Thread David Winsemius
On Jan 30, 2010, at 2:11 PM, Juliet Hannah wrote: Hi Group, Consider a data frame like this: mylabel1 <- rep(c("A","B","C"),each=3) mylabel2 <- rep(c("A","B","C"),3) corrs <- c(1,.8,.7,.8,1,.7,.7,.7,1) myData <- data.frame(mylabel1,mylabel2,corrs) myData mylabel1 mylabel2 corrs 1A

[R] convert data frame of values into correlation matrix

2010-01-30 Thread Juliet Hannah
Hi Group, Consider a data frame like this: mylabel1 <- rep(c("A","B","C"),each=3) mylabel2 <- rep(c("A","B","C"),3) corrs <- c(1,.8,.7,.8,1,.7,.7,.7,1) myData <- data.frame(mylabel1,mylabel2,corrs) myData mylabel1 mylabel2 corrs 1AA 1.0 2AB 0.8 3A

Re: [R] Questions on Mahalanobis Distance

2010-01-30 Thread Robert Lonsinger
I have been able to implement the Mahalanobis distance function, and I have also been able to generate code that computes the mahalanobis distance calculations. Both have resulted in the same results, though these results differ from the true results. I believe my problem is in the formulation of

Re: [R] question about time series objects

2010-01-30 Thread Dipankar Basu
Thanks a lot; this helps a lot. On Sat, Jan 30, 2010 at 11:07 AM, Gabor Grothendieck < ggrothendi...@gmail.com> wrote: > See ?window.ts, e.g. > > > # 1 > > tt <- ts(c(0.71, 0.63, 0.85, 0.44, 0.61, 0.69, 0.92, 0.55), > + start = 1960, frequency = 4) > > at <- c(1961, 3) > > window(tt, at, at)[1]

[R] pca in R

2010-01-30 Thread ogbos okike
Hi, I am learning how to do principal component analysis in R. However, since I am family with only a few built-in functions like prcomp, sd, cor, I started manually with examples in text books while trying to use the few functions I know to manipulate what they have in the text. From the example i

Re: [R] Call m file in R

2010-01-30 Thread Kjetil Halvorsen
fortune("reverse") On Sat, Jan 30, 2010 at 1:38 PM, Yong Zhang wrote: > Hi, > > > > Does anyone know how to call a Matlab file (M-file) in R? > > Thanks! > > > > Yong > > >        [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailin

Re: [R] Call m file in R

2010-01-30 Thread David Winsemius
On Jan 30, 2010, at 11:38 AM, Yong Zhang wrote: Hi, Does anyone know how to call a Matlab file (M-file) in R? You are expecting R to read Matlab source files directly? Or do you (more reasonably) want to read datafiles or use R as a client with Matlab as a server? Package R.matlab h

Re: [R] drawing a line that shifts from solid to broken

2010-01-30 Thread David Winsemius
On Jan 30, 2010, at 10:33 AM, Jamie Smith wrote: I am graphing longitudinal data from three time points. I'd like to draw a solid line from point 1 to point 2, and then a dashed line from point 2 to point 3. It works if I do it in two steps: first.vector <- c(mean(year1$variable1), mean(y

Re: [R] SemiPar/spm question

2010-01-30 Thread hadley wickham
Hi Chuck, It looks like a scoping bug in spmx to me: f <- function() { x <- data[data$id=="111",] print(spm(x$value ~ f(1:nrow(x } f() I'd suggest you contact the package maintainer directly. Hadley On Fri, Jan 29, 2010 at 1:34 PM, Chuck White wrote: > Hello -- I posted this question

Re: [R] Solving an optimization problem: selecting an "optimal" subset

2010-01-30 Thread Bart Joosen
Here some kind of a brute force attack: #brute force solution, only working with relative small subsets: n <- 200 elem <- 3 target <- 200 x <- rnorm(n,100,10) x.combinations <- combn(x,elem) sums <- apply(x.combinations,2,function(x) (sum(x)-target)^2) ans <- (x.combinations[,which.min(sums)])

Re: [R] regression with categorial variables

2010-01-30 Thread Peter Ehlers
kayj wrote: Hi All, I am working on an example where the electric utility is investigating the effect of size of household and the type of air conditioning on electricity consumption. I fit a multiple linear regression Electricity consumption=size of the house hold + air conditioning type Th

Re: [R] Using win-builder with static libraries

2010-01-30 Thread Uwe Ligges
I may be able to help if you upload to winbuilder again and let me know when you did (don't have your source package any more). I guess there are roughly 1-5 errors: error 1: Where is the static library from? If copied from numerical recipes: Please do look if you have the right licenses. er

[R] Call m file in R

2010-01-30 Thread Yong Zhang
Hi, Does anyone know how to call a Matlab file (M-file) in R? Thanks! Yong [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://

Re: [R] combine 3 affybatches

2010-01-30 Thread Uwe Ligges
On 29.01.2010 11:44, joez wrote: Hello, Im trying to combine 3 affybatches (1x hgu133+2 array and 2x hgu133a array) Im useing this script: library(matchprobes) library(affy) library(AnnotationDbi) library(hgu133plus2probe) library(hgu133aprobe) library(hgu133a.db) u133p2 = ReadAffy() # readin

Re: [R] evaluating expressions with sub expressions

2010-01-30 Thread Gabor Grothendieck
On Sat, Jan 30, 2010 at 10:39 AM, Jennifer Young wrote: > handling of variables in R to be very straightforward; sometimes I pine > for Maple to do my algebra for me... There are several interfaces to Computer Algebra Systems in R. Try this (but read instructions on home page http://ryacas.goo

Re: [R] question about time series objects

2010-01-30 Thread Gabor Grothendieck
See ?window.ts, e.g. > # 1 > tt <- ts(c(0.71, 0.63, 0.85, 0.44, 0.61, 0.69, 0.92, 0.55), + start = 1960, frequency = 4) > at <- c(1961, 3) > window(tt, at, at)[1] [1] 0.92 Note that 1961.00, 1961.25, 1961.50 and 1961.75 represent the 4 quarters of 1961 so this also works: # 2 > window(tt, 1961

Re: [R] How do people use Sweave / R / Databases

2010-01-30 Thread Anne York
On Fri, 29 Jan 2010, Paul wrote: P > I'm currently using r scripts in sweave to grab some data via ODBC, process P > it then generate some tables. I'd like to be able to give someone the files P > and let them reproduce what I've done. Is there some way to store the data P > that is gathered b

Re: [R] Fwd: Re: Graph color

2010-01-30 Thread Jose Narillos de Santos
Many thanks I will try to check it latter¡¡¡ One more think... To add a box on a plot (and locate where you want (I think you will say floating)) you know the function? Not a Lengend but something similar but writting what you want inside to indicate wat you want. 2010/1/30 Jim Lemon > On 0

Re: [R] Solving an optimization problem: selecting an "optimal" subset

2010-01-30 Thread Dimitri Shvorob
Found this http://n4.nabble.com/Subset-sum-problem-td954423.html#a954423 http://n4.nabble.com/The-subset-matching-challenge-td861840.html#a861840 and learnt/remebered about 'subset sum' and 'knapsack' problems. My case is different (simpler) in that subset size is fixed. -- View this message

Re: [R] Solving an optimization problem: selecting an "optimal" subset

2010-01-30 Thread Dimitri Shvorob
> This is a "subset sum" problem and has been discussed here in December Thanks a lot! Will investigate. > Can you settle for an approximate solution? Absolutely. > Rcplex: This is a combinatorial problem and cannot be formulated as a > quadratic optimization problem. If the objective func

[R] drawing a line that shifts from solid to broken

2010-01-30 Thread Jamie Smith
I am graphing longitudinal data from three time points. I'd like to draw a solid line from point 1 to point 2, and then a dashed line from point 2 to point 3. It works if I do it in two steps: > first.vector <- c(mean(year1$variable1), mean(year2$variable1)) > second.vector <- c(NA, mean(year2$var

Re: [R] evaluating expressions with sub expressions

2010-01-30 Thread Jennifer Young
Thanks so much everyone! Bert's shorted example does what I need, but I'm filing away Gabor's solution for when I inevitably need it some day. I've never found the handling of variables in R to be very straightforward; sometimes I pine for Maple to do my algebra for me... > If its good enough t

Re: [R] question about time series objects

2010-01-30 Thread David Winsemius
On Jan 30, 2010, at 9:22 AM, Dipankar Basu wrote: Hi All, I have a very simple question about a time series object: how to access values for a particular year and quarter (say)? Suppose, following http://www.stat.pitt.edu/stoffer/tsa2/R_time_series_quick_fix.htm I have read in data as a

Re: [R] parsing files for plot

2010-01-30 Thread Maxim
Great, works perfect!!! Thanks a lot Maxim 2010/1/30 baptiste auguie > Hi again, > > Below are two versions, depending on whether you want to use scan or > read.table, > > ## with scan > library(reshape) > listOfFiles <- list.files() > d <- llply(listOfFiles, scan) > names(d) <- basename(l

Re: [R] use zoo package with multiple column data sets

2010-01-30 Thread Gabor Grothendieck
Its a bug. Its now fixed it in the development source so try this: library(chron) library(zoo) source("http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/zoo/R/na.approx.R?rev=653&root=zoo";) source("http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/zoo/R

Re: [R] Questions on Mahalanobis Distance

2010-01-30 Thread Sarah Goslee
If the goal is to *use* the Mahalanobis distance, rather than to learn how to write your own code, there are several existing implementations. rseek.org is a good place to find functions. Sarah On Fri, Jan 29, 2010 at 9:48 PM, Robert Lonsinger wrote: > Hello, > I am a new R user and trying to le

[R] question about time series objects

2010-01-30 Thread Dipankar Basu
Hi All, I have a very simple question about a time series object: how to access values for a particular year and quarter (say)? Suppose, following http://www.stat.pitt.edu/stoffer/tsa2/R_time_series_quick_fix.htm I have read in data as a time series; here is how it looks. * Qtr1 Qtr2 Q

Re: [R] parsing files for plot

2010-01-30 Thread baptiste auguie
Hi again, Below are two versions, depending on whether you want to use scan or read.table, ## with scan library(reshape) listOfFiles <- list.files() d <- llply(listOfFiles, scan) names(d) <- basename(listOfFiles) melt(d) ## with read.table listOfFiles <- list.files() names(listOfFiles) <- base

Re: [R] parsing files for plot

2010-01-30 Thread Maxim
Hi, my data is really not spectacular, each of the 6 files (later several hundred) contains correlation coefficients in plain text format like: 0.923960073 0.923960073 0.612571344 0.064183275 0.007733399 -0.315444372 -0.064591277 -0.268336142 ... with between 1000-13000 rows. Scanning f

Re: [R] Solving an optimization problem: selecting an & quot;optimal" subset

2010-01-30 Thread Hans W Borchers
Dimitri Shvorob gmail.com> writes: > > > Is it a subset of a vector containing 100 elements, or 1ths? > > I need to pick 2-40 elements out of a 50-200-element-long vector. > > > A random number of elements that should be chosen, or the best 10 values > > which sums up to a defined value?

Re: [R] parsing files for plot

2010-01-30 Thread baptiste auguie
Hi, Hadley recently proposed a strategy using plyr for a very similar problem, listOfFiles <- list.files() names(listOfFiles) <- basename(listOfFiles) library(plyr) d <- ldply(listOfFiles, scan) Even if you don't want to use plyr, it's always better to group things in a list rather than clutter

Re: [R] Solving an optimization problem: selecting an "optimal" subset

2010-01-30 Thread Dimitri Shvorob
> Is it a subset of a vector containing 100 elements, or 1ths? I need to pick 2-40 elements out of a 50-200-element-long vector. > A random number of elements that should be chosen, or the best 10 values > which sums up to a defined value? The best 10 values. I still think that Rcplex

Re: [R] How to choose a number subset with sum closest to x?

2010-01-30 Thread Dimitri Shvorob
Oh, I have considered this, but just don't see how the problem can be cast as LSAP. (In the example, sum of squared pairwise distances ('costs') is minimized, whereas here I am squaring the distance of a sum from the target number. (How do I define individual assignment's cost here?) Thanks anyway

[R] parsing files for plot

2010-01-30 Thread Maxim
Hi, I have many files containing one column of data. I like to use the scan function to parse the data. Next I like to bind to a large vector. I try this like: count<-1 files <- list.files() # all files in the working directory for(i in files) { tmp <- scan(i) assign(files[count],

Re: [R] convert a data frame with NULL to a list of integer

2010-01-30 Thread jim holtman
Exactly how do you want to convert it? It looks like you have columns that are not integers, but factors. Can you provide an 'str' of the dataframe so that we can see what the structure is. Can you also provide an idea of what you want as output; you say a multiple list of integers, but I am not

Re: [R] use zoo package with multiple column data sets

2010-01-30 Thread e-letter
> library(chron) > library(zoo) > z1<-read.zoo("~/path/to/test1.csv",header=TRUE,sep=",",FUN=times) > z2<-read.zoo("~/path/to/test2.csv",header=TRUE,sep=",",FUN=times) > z3<-(na.approx(merge(z1,z2),time(z1))) Error in approx(along[!na], y[!na], along[na], ...) : need at least two non-NA val

Re: [R] Solving an optimization problem: selecting an "optimal" subset

2010-01-30 Thread Bart Joosen
Could you please specifiy your problem, if possible with some data? Is it a subset of a vector containing 100 elements, or 1ths? A random number of elements that should be chosen, or the best 10 values which sums up to a defined value? Bart -- View this message in context: http://n4.nabble.

Re: [R] How to draw a border for multiple graphs in one pager

2010-01-30 Thread Jim Lemon
On 01/30/2010 02:22 AM, Lu Wang wrote: ... My question is How do I remove the outside frame. It seems that Box() can only generate four sided boders. Or is there any way that I can draw the inner border without using box(). Try using box only on the second and third plot: pie(value,labels=lbls

Re: [R] question about transpose

2010-01-30 Thread Joshua Wiley
Hello, Here are three examples.  I have a hunch you are looking for the last one. > test <- matrix(LETTERS[1:6], nrow=2, dimnames=list(c("First", "Second"))) > #explicitly stating what the rownames are before transposing > test    [,1] [,2] [,3] First  "A"  "C"  "E" Second "B"  "D"  "F" > t

Re: [R] help on drawing right colors within a grouped xyplot (Lattice)

2010-01-30 Thread Deepayan Sarkar
On Fri, Jan 29, 2010 at 2:29 PM, Zoppoli, Gabriele (NIH/NCI) [G] wrote: > Hi, > > I've lost my mind on it... I have to scatterplot two vectors, grouped by a > third variable, with two different dimensions according to whether each cell > line in the plot is sensitive or resistant to a given drug