Re: [R] Trouble with optim on a specific problem

2009-06-16 Thread Liviu Andronic
Hello, On 6/16/09, Stu @ AGS s...@agstechnet.com wrote: Error in optim(c(0.66, 0.999, 0.064), pe, NULL, method = L-BFGS-B) : objective function in optim evaluates to length 6 not 1 skip pe - function(c) c[1]*x1*x2^c[2]*x3^c[3] I would suspect a matrix multiplication issue. In order to

Re: [R] books on Time series

2009-06-16 Thread Stefan Grosse
On Sun, 14 Jun 2009 22:30:49 -0300 Antonio Olinto aolint...@bignet.com.br wrote: AO I would like to receive any suggestion of which is most appropriate AO for a non-statistician (I am a biologist). Reading only the index I AO could not evaluate it. AO reproducible code. I am an economist but

[R] confusion on levels() function, and how to assign a wanted order to factor levels, intentionally?

2009-06-16 Thread Mao Jianfeng
Dear R-helpers, I want to make a series of boxplots on several numeric univariates with two group variables (species and population, population nested in species, and with population as the X-axis). In order to get a proper order of the individual populations in X-axis, I need to assign a wanted

Re: [R] confusion on levels() function, and how to assign a wanted order to factor levels, intentionally?

2009-06-16 Thread xavier . chardon
Hi, The way you do it actually renames the factors one after each other (it replaces the values in the data frame, which is not what you want). Have a look at this code: test - data.frame(id=c(1,2,3), fac=c(lv1, lv2, lv3) ) levels(test$fac) test$fac2 - factor(test$fac, levels=c(lv3, lv2, lv1))

Re: [R] confusion on levels() function, and how to assign a wanted order to factor levels, intentionally?

2009-06-16 Thread Zeljko Vrba
On Tue, Jun 16, 2009 at 03:14:01PM +0800, Mao Jianfeng wrote: levels(d$population)-c(YXPy01, KMPy01, YLPy01, GSPy02, BCPy01, LJPy01, GYPt01, YLPd01, CYPd01, CYPd02, CYPd03, BXPd01, NSPt01) I'm not at home with factors myself, but maybe this will do the trick for you: d$population -

[R] R Biocep

2009-06-16 Thread malcolm Crouch
http://biocep-distrib.r-forge.r-project.org/doc.html Regards Malcolm [[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

[R] save the output of summary(lmList(x)) into a dataframe

2009-06-16 Thread Cecilia Carmo
Hi r-helpers! I need to save the output of summary() function that I’ve runned like this: z- lmList(y~x1+x2| x3, na.action=na.omit,data1,subset=year==1999) w-summary(z) The output (w) is something like this: Call: Model: y ~ x1 + x2 | x3 Data: data1 Coefficients: (Intercept)

Re: [R] confusion on levels() function, and how to assign a wanted order to factor levels, intentionally?

2009-06-16 Thread Mark Difford
Hi Mao, I am confused. And, I want to know how to assign a wanted order to factor levels, intentionally? You want ?relevel. Although the documentation leads one to think that it can only be used to set a reference level, with the other levels being moved down, presently it can in fact be

Re: [R] Schoenfeld Residuals with tied data

2009-06-16 Thread Bessy
Thank you for the reply. I really appreciate it. I calculated the Scoenfeld residual per event and my results are the following: finage race 17 -0.33942334 -2.0722187270.29024804 20 0.394600944 5.303968774 0.517689472 25

[R] color gradation inversion.

2009-06-16 Thread Naoki Irie
Dear list I'm having trouble with inverting color gradation. As seen in the rgl example, library(rgl) example(rgl.surface) I understand that I can assign colors to heights for each point. col - colorlut[ y-ylim[1]+1 ] # assign colors to heights for each point However, I am now trying to

[R] tapply with cbinded x

2009-06-16 Thread Stefan Uhmann
Dear List, why does this not work? df - data.frame(var1 = c(3,2,1), var2 = c(6,5,4), var3 = c(9,8,7), fac = c('A', 'A', 'B')) tapply(cbind(df$var1, df$var2, df$var3), df$fac, mean) Thank you, Stefan __ R-help@r-project.org mailing list

Re: [R] confusion on levels() function, and how to assign a wanted order to factor levels, intentionally?

2009-06-16 Thread baptiste auguie
Hi, I tend to use a slightly modified version of stats::relevel, (from an old thread on this list), relevel = function (x, ref, ...) { lev - levels(x) if (is.character(ref)) ref - match(ref, lev) if (any(is.na(ref))) stop('ref' must be an existing level) nlev - length(lev)

Re: [R] confusion on levels() function, and how to assign a wanted order to factor levels, intentionally?

2009-06-16 Thread Peter Dalgaard
Mark Difford wrote: Hi Mao, I am confused. And, I want to know how to assign a wanted order to factor levels, intentionally? You want ?relevel. Although the documentation leads one to think that it can only be used to set a reference level, with the other levels being moved down,

Re: [R] [R-help] how to install own R withour root?

2009-06-16 Thread Daofeng Li
Hi, actullay i am try to intsall Rpy2 (a python interface for R) later, for RPy2 requries R 2.7.0 higher but default intsall RPy2 will search the system installed R 2.4.0 so i think to replace the system installed R with my R in my home directory echo $PATH

Re: [R] [R-help] how to install own R withour root?

2009-06-16 Thread Daofeng Li
Hi, i just add /home/lidaof/R/bin and /home/lidaof/R/lib to the end of the PATH variable yet i type R command runs the system installed R 2.4.0... On Tue, Jun 16, 2009 at 5:48 PM, Daofeng Li lid...@gmail.com wrote: Hi, actullay i am try to intsall Rpy2 (a python interface for R) later, for

[R] Superscript in y-axis of plot

2009-06-16 Thread Steve Murray
Dear all, I've been trying to superscript the '2' in the following command (I don't want the '^' displayed), but as yet haven't had much luck. I've tried both the paste and expression commands, but neither have brought me any joy! mtext(side=2, line=5.5, Monthly Precipitation (mm x

Re: [R] confusion on levels() function, and how to assign a wanted order to factor levels, intentionally?

2009-06-16 Thread baptiste auguie
Commenting on this, is there a strong argument against modifying relevel() to reorder more than one level at a time? I started a topic a while back (recursive relevel, https://stat.ethz.ch/pipermail/r-help/2009-January/184397.html) and I've happily used the proposed change since then by

Re: [R] Connecting to heterogenous cluster using makeSOCKcluster of SNOW-package

2009-06-16 Thread Melwin
Thanks to Luke Tiernay and some experimenting I found out some issues. I don't claim this infomation is complete, but it may be helpful for anyone experimenting with SNOW on Linux: - environment variables PATH and R_SNOW_LIB need to be set on master and slaves. (manually or permanent in

Re: [R] MS-VAR introduction

2009-06-16 Thread Sandrine LUNVEN
Dear Henrique, I think that R is not actually the best statistical tool to model MS-VAR. Indeed, the package msvar only allow a simple specification of the model. One tool I have ever used is on Ox with the package MSVAR built by Krolzig. This package allow a large variety of model

Re: [R] tapply with cbinded x

2009-06-16 Thread Wacek Kusnierczyk
Stefan Uhmann wrote: Dear List, why does this not work? df - data.frame(var1 = c(3,2,1), var2 = c(6,5,4), var3 = c(9,8,7), fac = c('A', 'A', 'B')) tapply(cbind(df$var1, df$var2, df$var3), df$fac, mean) because length(cbind(df$var1, df$var2, df$var3)) # 9 length(df$fac)

Re: [R] [R-help] how to install own R withour root?

2009-06-16 Thread Patrick Connolly
On Tue, 16-Jun-2009 at 05:48PM +0800, Daofeng Li wrote: | Hi, | | actullay i am try to intsall Rpy2 (a python interface for R) later, for RPy2 | requries R 2.7.0 higher But as I mentioned earlier, R-2.9.0 is current and R-2.9.1 will be released next week. It's nearly always best to use a

Re: [R] Superscript in y-axis of plot

2009-06-16 Thread Philipp Pagel
On Tue, Jun 16, 2009 at 10:01:00AM +, Steve Murray wrote: I've been trying to superscript the '2' in the following command (I don't want the '^' displayed), but as yet haven't had much luck. I've tried both the paste and expression commands, but neither have brought me any joy!

Re: [R] S4: Bug in group method defenition (Compare)

2009-06-16 Thread Vitalie S.
Setting methods for groups (compare in this case) does not work properly. Once one method is set ,redefining it or even removing does not change the behavior: Can anyone suggest how to refresh methods table for some particular generic? (in the above case Compare group generic). For now

Re: [R] tapply with cbinded x

2009-06-16 Thread Stavros Macrakis
On Tue, Jun 16, 2009 at 5:16 AM, Stefan Uhmann stefan.uhm...@googlemail.com wrote: why does this not work? df - data.frame(var1 = c(3,2,1), var2 = c(6,5,4), var3 = c(9,8,7), fac = c('A', 'A', 'B')) tapply(cbind(df$var1, df$var2, df$var3), df$fac, mean) Because tapply is defined for

Re: [R] tapply with cbinded x

2009-06-16 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 16.06.2009 12:45:04: Stefan Uhmann wrote: Dear List, why does this not work? df - data.frame(var1 = c(3,2,1), var2 = c(6,5,4), var3 = c(9,8,7), fac = c('A', 'A', 'B')) tapply(cbind(df$var1, df$var2, df$var3), df$fac, mean) because

Re: [R] tapply with cbinded x

2009-06-16 Thread Wacek Kusnierczyk
Stavros Macrakis wrote: On Tue, Jun 16, 2009 at 5:16 AM, Stefan Uhmann stefan.uhm...@googlemail.com wrote: why does this not work? df - data.frame(var1 = c(3,2,1), var2 = c(6,5,4), var3 = c(9,8,7), fac = c('A', 'A', 'B')) tapply(cbind(df$var1, df$var2, df$var3),

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread utkarshsinghal
Hi All, There are several replies to the question below, but I think there must exist a better way of doing so. I just want to check whether all the elements of a vector are same. My vector has one million elements and it is highly likely that there are distinct elements in the first few

Re: [R] Superscript in y-axis of plot

2009-06-16 Thread baptiste auguie
For the sake of brevity, I like to use this trick, plot(0, 0) mtext(~Monthly Precipitation (mm x *10^2*/month)) HTH, baptiste __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] tapply with cbinded x

2009-06-16 Thread Wacek Kusnierczyk
Petr PIKAL wrote: Hi r-help-boun...@r-project.org napsal dne 16.06.2009 12:45:04: Stefan Uhmann wrote: Dear List, why does this not work? df - data.frame(var1 = c(3,2,1), var2 = c(6,5,4), var3 = c(9,8,7), fac = c('A', 'A', 'B')) tapply(cbind(df$var1, df$var2, df$var3),

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread jim holtman
Just check that the first (or any other element) is equal to all the rest: x = c(1,2,rep(1,1000)) # 10,000,000 system.time(print(all(x[1] == x))) [1] FALSE user system elapsed 0.180.000.19 This was for 10M entries. On Tue, Jun 16, 2009 at 7:42 AM, utkarshsinghal

Re: [R] Aligning axis values when plotting more than one graph on same axes

2009-06-16 Thread Jim Lemon
Steve Murray wrote: Dear R Users, I am trying to plot a barchart with a line graph superimposed (using par(new=TRUE)). There are 12 bars and 12 corresponding points for the line graph. This is fine, except that I'm encountering two problems: 1) The position of the points (of the line graph)

[R] ANNOUNCEMENT: 20% discount on the most recent R books from Chapman Hall/CRC!

2009-06-16 Thread Calver, Rob
Take advantage of a 20% discount on the most recent R books from Chapman Hall/CRC! We are pleased to offer our latest books on R at a 20% discount through our new website. To take advantage of this offer, simply visit http://www.crcpress.com/, choose your titles and insert code 281DW in the

[R] overshoot of formula line in summary output of Sweave

2009-06-16 Thread Ken Knoblauch
Hi, In the Sweave output for summary for several types of model objects and also for the comparison of models with anova, I find that that the display of the call(s) or formula does not obey the width option, even with keep.source=TRUE set, so that a long formula will overshoot the margins in

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread utkarshsinghal
Hi Jim, What you are saying is correct. Although, my computer might not have same speed and I am getting the following for 10M entries: user system elapsed 0.559 0.038 0.607 Moreover, in the case of character vectors, it gets more than double. In my modeling, which is already highly

Re: [R] reading Excel file

2009-06-16 Thread Hans-Peter Suter
I was using older version of R (installed early). I install new version of R (R.2.9.0) but i could not find package xlsReadWrite to read Excel file. As others have pointed out (thanks) you can find it here: http://treetron.googlepages.com/. It runs fine in 2.9.0. Is there any alternatives to

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread jim holtman
I think the only way that you are going to get it to stop on the first mismatch is to write your own function in C if you are concerned about the time. Matching on character vectors will be even more costly since it is having to loop to check the equality of each character in each element. This

[R] Package Install Design fails on Ubuntu 8.04

2009-06-16 Thread Dennis Proppe
Dear All, I am running a Ubuntu 8.04 System and trying to install the Design-package. Hmisc is already installed, all fortran compilers and a Tex-Package are also on board. I searched the net and the help list for analogue threads, but didn't find any. Whenever I run the

[R] help I want to use anova-pca.

2009-06-16 Thread yongkook Kwon
Hi I want to use anova-pca method, but I don't know what package I use to. [[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

Re: [R] color gradation inversion.

2009-06-16 Thread David Winsemius
?rev On Jun 16, 2009, at 5:13 AM, Naoki Irie wrote: Dear list I'm having trouble with inverting color gradation. As seen in the rgl example, library(rgl) example(rgl.surface) I understand that I can assign colors to heights for each point. col - colorlut[ y-ylim[1]+1 ] # assign colors

[R] Output of Anova (CAR package) in Sweave

2009-06-16 Thread Maria Wolters
Dear list, I use Sweave almost exclusively for writing papers, and I have become quite spoiled by the excellent xtable export facilities. Has anybody written an xtable method for the Anova function in CAR, or has anybody used a different set of functions to import Anova results into a table in

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread baptiste auguie
utkarshsinghal wrote: Hi Jim, What you are saying is correct. Although, my computer might not have same speed and I am getting the following for 10M entries: user system elapsed 0.559 0.038 0.607 Moreover, in the case of character vectors, it gets more than double. In my

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 16.06.2009 14:31:21: Hi Jim, What you are saying is correct. Although, my computer might not have same speed and I am getting the following for 10M entries: user system elapsed 0.559 0.038 0.607 With numbers you may speed it a bit

[R] Chron / zoo index problem

2009-06-16 Thread rory . winston
Hi all I have an irregular zoo series, where the time index looks like the following: head(time(l.zoo)) [1] 2009-06-15 01:44:20.802 GMT 2009-06-15 01:44:20.812 GMT 2009-06-15 01:44:20.837 GMT 2009-06-15 01:44:20.848 GMT 2009-06-15 06:00:01.320 GMT [6] 2009-06-15 06:00:01.330 GMT

Re: [R] Trouble with optim on a specific problem

2009-06-16 Thread Stu @ AGS
Thanks for your response! No, my basic equation does not use matrices at all. It takes scalar values and returns a scalar. What I am trying to accomplish is to find the best-fit coefficients to the equation as follows: y ~ c1 * x1 * x2^c2 * x3^c3 where y, x1, x2, and x3 are observed data and

Re: [R] Schoenfeld Residuals with tied data

2009-06-16 Thread Terry Therneau
-- begin included message Thank you for the reply. I really appreciate it. I calculated the Scoenfeld residual per event and my results are the following: finage race 17 -0.33942334 -2.0722187270.29024804 20 0.394600944

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread baptiste auguie
[correcting a stupid error in my previous post] testTwoStages - function(x, y, head.stop = 100){ if(!isTRUE(all(head(x, head.stop) == head(y, head.stop { print(paste(quick test returned FALSE)) return(FALSE) } else { full.test = isTRUE(all(tail(x, length(x) - head.stop) == tail(y,

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread utkarshsinghal
Not in the direction I was looking, but your function fff really speed up the process, and using it along with fff3 is fine for me. Thanks Petr PIKAL wrote: Hi r-help-boun...@r-project.org napsal dne 16.06.2009 14:31:21: Hi Jim, What you are saying is correct. Although, my computer

[R] Generation from COX PH with gamma frailty

2009-06-16 Thread Cetinyürek Aysun
Hello, I want to generate data set from Cox PH model with gamma frailty effects. theta(parameter for frailty distribution)=2 beta=1.5 n=300 cluster size=30 number of clusters=10 I think I should first generate u from Gamma(Theta,theta) and then using this theta I could not decide how I should

Re: [R] Assigning Data a name from within another variable?

2009-06-16 Thread Kenny Larsen
Thnaks to both of you, with a combined effort of the Wiki and your code I have now managed to get teh result I was after. When I have a better understanding of what the code is doing I shall make an effort to contribut to the Wiki! Cheers, Kenny Kenny Larsen wrote: Hi All, I have

Re: [R] Output of Anova (CAR package) in Sweave

2009-06-16 Thread John Fox
Dear Maria, -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Maria Wolters Sent: June-16-09 6:31 AM To: r-help@r-project.org Subject: [R] Output of Anova (CAR package) in Sweave Dear list, I use Sweave almost exclusively

Re: [R] Package Install Design fails on Ubuntu 8.04

2009-06-16 Thread Frank E Harrell Jr
Not to fix your fundamental problem, but if you don't mind using the next-to-last versions of the packages you can install them quite easily as debian/Ubuntu packages. They are named r-cran-hmisc and r-cran-design. You can use sudo apt-get install ... or the adept package manager etc. Frank

Re: [R] Chron / zoo index problem

2009-06-16 Thread Gabor Grothendieck
See R News 4/1. On Tue, Jun 16, 2009 at 9:04 AM, rory.wins...@gmail.com wrote: Hi all I have an irregular zoo series, where the time index looks like the following: head(time(l.zoo)) [1] 2009-06-15 01:44:20.802 GMT 2009-06-15 01:44:20.812 GMT 2009-06-15 01:44:20.837 GMT 2009-06-15

[R] How to replace outliers by group median?

2009-06-16 Thread Mao Jianfeng
Dear R-helpers, Very small amount of outliers can greatly affect the mean and many other statistic of a numeric variable. So, usually we must deal with the outliers properly in the process of data analysis. Here, I want to replace outliers with the group median of the variable. But, I can not

Re: [R] Chron / zoo index problem

2009-06-16 Thread rory . winston
Thanks Gabor - I'll check it out. Actually I just realised I can also do what I am looking for in a ridiculously simple manner (as the data I have is intra-day): aggregate(l.zoo, hours(index(l.zoo)), mean) Cheers -- Rory On Jun 16, 2009 2:46pm, Gabor Grothendieck ggrothendi...@gmail.com

Re: [R] save the output of summary(lmList(x)) into a dataframe

2009-06-16 Thread milton ruser
Hi Cecilia, Could you send us a reproducible example? cheers milton On Tue, Jun 16, 2009 at 4:29 AM, Cecilia Carmo cecilia.ca...@ua.pt wrote: Hi r-helpers! I need to save the output of summary() function that I’ve runned like this: z- lmList(y~x1+x2| x3,

Re: [R] How to replace outliers by group median?

2009-06-16 Thread Frank E Harrell Jr
This is a sure way to get a biased variance estimate. Instead, use a robust dispersion (scale) estimator such as Gini's mean difference (average absolute difference between any two observations). The median is a robust location estimator. There are others. If your ultimate goal is a

[R] xyplot format axis

2009-06-16 Thread taz9
Hi All, I'm trying to format the y-axis in an xyplot to show numbers with a comma separating the thousands but I'm not able to do it using formatNum(y, big.mark=,). This is what I have: library(lattice) year-c(2003,2004,2005,2006,2007,2008,2003,2004,2005,2006,2007,2008)

Re: [R] Output of Anova (CAR package) in Sweave

2009-06-16 Thread Maria Wolters
Many thanks to John Fox, who replied on-list, and to David Hajage, who replied to me off list. David suggested this quick hack of the print.anova.mlm function, which I am sharing with his permission # From print.Anova.mlm xtable.Anova.mlm - function (x, ...) { test - x$test repeated -

[R] question about adding plots in a grid (lattice package)

2009-06-16 Thread Marion Dumas
Hello! I am starting to use the lattice package. I generated an xyplot conditioned on a factor that has three levels: hence I get three plots in three panels spaces and one is left empty. I would like to add a plot to the empty panel space. Is it possible? Thank you

Re: [R] books on Time series

2009-06-16 Thread Bailey, Jason W LCDR OPNAV, N81
Antonio, I just got the Cowpertwait and Metcalfe book (released today in the U.S.) and I think it's what you're looking for. It has good, practical examples and lots of sample code. I looked at Cryer's book, but it had too much on time series theory for my purposes; Cowpertcalfe helpfully

[R] Question regarding dataframes, matrix, frame, etc...

2009-06-16 Thread njhuang86
Hi all, As of now, I have a 15x8 matrix (name is asdf). The first seven columns contain numbers while the last column contains a string. The class of each column is character. When I use the plot function to display a scatter plot between any of the two columns, ie. plot(asdf[, 1], asdf[, 2])

[R] R and miRecords

2009-06-16 Thread mauede
I wonder whether R provides an interface to access miRecords data. Particularly, I am looking for extracting humans miRNA and target genes sequences. All such information is stored in there in a set of structured web site pages (http://mirecords.umn.edu/miRecords) I would greatly appreciate

[R] The most straightfoward way to write a function that sums over the rows of a matrix

2009-06-16 Thread Stu @ AGS
Hello! I am trying to write a function with vector and data.frame parameters that uses the sum() function and values from the rows of the data.frame. I need to pass this function as a parameter to optim(). My starting point is: observs - data.frame(y, x1, x2, x3) Fn - function(par,

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread Prof Brian Ripley
On Tue, 16 Jun 2009, jim holtman wrote: I think the only way that you are going to get it to stop on the first mismatch is to write your own function in C if you are concerned about the time. Matching on character vectors will be even more costly since it is having to loop to check the

Re: [R] Question regarding dataframes, matrix, frame, etc...

2009-06-16 Thread stephen sefick
plot(asdf[,1:7]) On Tue, Jun 16, 2009 at 10:58 AM, njhuang86njhuan...@yahoo.com wrote: Hi all, As of now, I have a 15x8 matrix (name is asdf). The first seven columns contain numbers while the last column contains a string. The class of each column is character. When I use the plot function

Re: [R] [R-help] how to install own R withour root?

2009-06-16 Thread Michael Dewey
At 10:57 16/06/2009, Daofeng Li wrote: Hi, i just add /home/lidaof/R/bin and /home/lidaof/R/lib to the end of the PATH variable yet i type R command runs the system installed R 2.4.0... [snip] On Sat, 13-Jun-2009 at 03:43PM +1000, bill.venab...@csiro.au wrote: | You need to adjust your

Re: [R] The most straightfoward way to write a function that sums over the rows of a matrix

2009-06-16 Thread Ronggui Huang
Why not just use rowSums? Ronggui 2009/6/16 Stu @ AGS s...@agstechnet.com: Hello! I am trying to write a function with vector and data.frame parameters that uses the sum() function and values from the rows of the data.frame. I need to pass this function as a parameter to optim(). My

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread Prof Brian Ripley
On Tue, 16 Jun 2009, Prof Brian Ripley wrote: On Tue, 16 Jun 2009, jim holtman wrote: I think the only way that you are going to get it to stop on the first mismatch is to write your own function in C if you are concerned about the time. Matching on character vectors will be even more costly

[R] Error using getBM() to query BioMart archives

2009-06-16 Thread Aaron Wolen
I'm trying to identify the positions of all genes within a specific chromosomal region using biomart. When using the current biomart database I'm able to do this without issue. However, I need to use build 36 of the mouse genome which was last included in ensembl mart 46. I selected this

Re: [R] R and miRecords

2009-06-16 Thread David Winsemius
Looks like a BioConductor question. On Jun 16, 2009, at 11:05 AM, mau...@alice.it wrote: I wonder whether R provides an interface to access miRecords data. Particularly, I am looking for extracting humans miRNA and target genes sequences. All such information is stored in there in a set of

Re: [R] The most straightfoward way to write a function that sums over the rows of a matrix

2009-06-16 Thread David Winsemius
The apply function is the way to iterate over rows or columns of dataframes or matrices. An example would have made this process easier testing and I have given up doing that job for You might try: apply(observs, 1, function(x) Fn(par, x) ) On Jun 16, 2009, at 11:08 AM, Stu @ AGS wrote:

Re: [R] Question regarding dataframes, matrix, frame, etc...

2009-06-16 Thread David Winsemius
?data.matrix Perhaps: pairs(data.matrix(asdf[ , 1:7]) ) On Jun 16, 2009, at 10:58 AM, njhuang86 wrote: Hi all, As of now, I have a 15x8 matrix (name is asdf). The first seven columns contain numbers while the last column contains a string. The class of each column is character. When

Re: [R] Sweave template

2009-06-16 Thread Kevin W
Frank, Your template is very interesting. The pretty-ifing of the left arrow and tilde in the input chunk has the unfortunate side-effect of making the code non-paste-able into R. I seem to recall that your reports used to include the latex source code as an appendix. Maybe one option could be

Re: [R] [R-help] how to install own R withour root?

2009-06-16 Thread Daofeng Li
Hi, yes, that's amazing follows my .bashrc file # .bashrc # User specific aliases and functions # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi alias rm='rm -i' if [ ! -d $HOME/trash ]; then mkdir $HOME/trash fi del ( ) { mv $@ $HOME/trash/.; }

Re: [R] save the output of summary(lmList(x)) into a dataframe

2009-06-16 Thread Daniel Malter
Hi, your problem has nothing to do with your specific dataset. Further, it is - let's say - suboptimal to push a 5 MB dataset through the mailing list. The posting guides asks to provide an example with self-contained code; this is what Milton has asked for. Such an example is not out of reach for

[R] adressing dataframes

2009-06-16 Thread John Fitzgerald
Hi everyone, I experience some problems with adressing of data.frames when I retrieve some information for geographical position (ypos, xpos) ot of a MySQL Database and want to perform some simple statistics. The problem is adressing the dataframes with a construct like rawdata[c(type)] vs.

[R] turning off escape sequences for a string

2009-06-16 Thread Stephen J. Barr
Hello, I would like to create a matrix with one of the columns named $\delta$. I have also created columns $\beta_1$ , $\beta_2$, etc. However, it seems like \d is an escape sequence which gets automatically removed. (Using these names such that they work right in xtable - latex)

Re: [R] Trouble with optim on a specific problem

2009-06-16 Thread Liviu Andronic
Hello, On 6/16/09, Stu @ AGS s...@agstechnet.com wrote: Thanks for your response! No, my basic equation does not use matrices at all. It takes scalar values and returns a scalar. Not quite. Taking the example above, if you run the following: with(observs , {1*x1*x2^2*x3^3}) [1] 0.000e+00

Re: [R] Trouble with optim on a specific problem

2009-06-16 Thread Stu @ AGS
Liviu, Thanks for your comments. With continued study and experimentation, I have discovered the following: a. I need to rewrite the function to return a 1x1 as you suggested; b. it seems that constrOptim() is the most appropriate routine to use on a

Re: [R] Sweave template

2009-06-16 Thread Frank E Harrell Jr
Kevin W wrote: Frank, Your template is very interesting. The pretty-ifing of the left arrow and tilde in the input chunk has the unfortunate side-effect of making the code non-paste-able into R. Kevin, I haven't needed to do that. It's best to make the .Rnw file available to others, or

Re: [R] adressing dataframes

2009-06-16 Thread David Winsemius
I have not figured out why you seem so attached to the c(type) strategy but try: numbers -summary(rawdata[ , c(type)] ) On Jun 16, 2009, at 12:06 PM, John Fitzgerald wrote: Hi everyone, I experience some problems with adressing of data.frames when I retrieve some information for

[R] Help implementing a simple Python port

2009-06-16 Thread Nathan Torrance
Hello list, I wonder if anyone might be able to help me troubleshoot an attempt at porting some simple Python code to R. The function below is supposed to take a matrix containing item ratings from various users and, given a vector containing at least 1 rating and 1 missing value, employ a

Re: [R] using lattice dotplot with two equal data points

2009-06-16 Thread Deepayan Sarkar
On Fri, Jun 12, 2009 at 10:54 AM, Chosid, David (FWE)david.cho...@state.ma.us wrote: I'm wondering if I am dealing with a limitation in lattice. It's probably due to my own limitations though. I'm working with a lattice dotplot. The x-axis is set at free. In one panel, there are only two

[R] Indexing Arbitrary Time Intervals in zoo Series

2009-06-16 Thread rory . winston
Hi guys Does anyone know if it is possible to index a zoo series by a sequence? For instance, with the following irregular zoo object, I can calculate the range of its time-based index: r - range(index(l.zoo)) r [1] 2009-06-15 01:44:20.802 GMT 2009-06-15 16:54:24.124 GMT If I just want to

[R] The R-Inferno

2009-06-16 Thread Stu @ AGS
Patrick, Thanks for your suggestion! The R-Inferno was especially useful!! The first chapter had me chuckling aloud despite the fact that I work alone. Well worth the price! Thanks! Stu -Original Message- From: Patrick Burns [mailto:pbu...@pburns.seanet.com]

[R] How to extract all rows that contain the value of X in any column?

2009-06-16 Thread Mark Na
Hi R-helpers, I'm trying to use this code pvh_dnv-pvh[sapply(pvh==dnv),] to make a new dataframe containing the rows from pvh that contain the value of dnv in ANY column. But, it's not working. I get this error Error in match.fun(FUN) : element 1 is empty; the part of the args list of

Re: [R] Indexing Arbitrary Time Intervals in zoo Series

2009-06-16 Thread Gabor Grothendieck
See ?window.zoo Also suggest you use dput to display sample data in posts to r-help. On Tue, Jun 16, 2009 at 1:19 PM, rory.wins...@gmail.com wrote: Hi guys Does anyone know if it is possible to index a zoo series by a sequence? For instance, with the following irregular zoo object, I can

Re: [R] How to extract all rows that contain the value of X in any column?

2009-06-16 Thread David Winsemius
No example. You are a regular now and examples ARE requested. Would have thought something along the lines of: pvh[ unlist( apply(pvh, 1, function(x) dnv %in% as.character(x) ) ) , ] Not sure if the unlist or as.character are really needed because ... no example on which to test. On

Re: [R] How to extract all rows that contain the value of X in any column?

2009-06-16 Thread Henrique Dallazuanna
Try this: pvh[apply(pvh == dnv, 2, any)] On Tue, Jun 16, 2009 at 2:41 PM, Mark Na mtb...@gmail.com wrote: Hi R-helpers, I'm trying to use this code pvh_dnv-pvh[sapply(pvh==dnv),] to make a new dataframe containing the rows from pvh that contain the value of dnv in ANY column. But,

Re: [R] How to extract all rows that contain the value of X in any column?

2009-06-16 Thread Henrique Dallazuanna
Sorry, it should be: pvh[apply(pvh == dnv, 1, any),] On Tue, Jun 16, 2009 at 3:09 PM, Henrique Dallazuanna www...@gmail.comwrote: Try this: pvh[apply(pvh == dnv, 2, any)] On Tue, Jun 16, 2009 at 2:41 PM, Mark Na mtb...@gmail.com wrote: Hi R-helpers, I'm trying to use this code

Re: [R] How to extract all rows that contain the value of X in any column?

2009-06-16 Thread Jorge Ivan Velez
Dear Mark, If I understood correctly, the following should work: index - apply(pvh, 1, function(x) any(x == dnv) ) pvh_dnv - pvh[index,] pvh_dnv HTH, Jorge On Tue, Jun 16, 2009 at 1:41 PM, Mark Na mtb...@gmail.com wrote: Hi R-helpers, I'm trying to use this code

[R] How to subset my dataframe? (a bit tricky)

2009-06-16 Thread Mark Na
Hi R-helpers, I would like to subset my dataframe, keeping only those rows which satisfy the following conditions: 1) the string dnv is found in at least one column; 2) the value in the column previous to the one dnv is found in is not 0 Here's what my data look like:     POND_ID 2009-05-07

[R] ui and ci explanatory documentation

2009-06-16 Thread Stu @ AGS
Hi Livia and everyone, Did you ever get a response on this question from last year (Jan 2008)? I am also looking for more explanatory documentation on the ui and ci parameters for the function constrOptim(). The examples provided in the R help and the full

Re: [R] Sweave template

2009-06-16 Thread Romain Francois
Frank E Harrell Jr wrote: Dear Group, I have made significant improvements to our Sweave template, have made the template self-contained (i.e., you can run it yourself and it will find the datasets it needs), and have included the output pdf file. This is at

Re: [R] turning off escape sequences for a string

2009-06-16 Thread Allan Engelhardt
Backslashes in character strings need to be doubled. Your \b is a backspace. \\ is a backslash. http://cran.r-project.org/doc/manuals/R-lang.html#Literal-constants On 16/06/09 17:12, Stephen J. Barr wrote: Hello, I would like to create a matrix with one of the columns named $\delta$. I

Re: [R] How to subset my dataframe? (a bit tricky)

2009-06-16 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Mark Na Sent: Tuesday, June 16, 2009 11:27 AM To: r-help@r-project.org Subject: [R] How to subset my dataframe? (a bit tricky) Hi R-helpers, I would like to subset my

Re: [R] R and miRecords

2009-06-16 Thread iaingallagher
Try TargetScan, Pictar, miRbase. These are all useful miRNA databases. Data can be downloaded as cvs or tab delimited files and parsed in R after that. In fact this may be possible with the resource you have looked at (although I haven't checked). Cheers Iain --- On Tue, 16/6/09, David

[R] Running stats on individual data.frames from the split() function list

2009-06-16 Thread Eric Vander Wal
Hello, and thanks in advance. I have a data.frame from which I want to count observations that occur on each day and determine the mean and std.error of said counts. For instance: x-split(my.df, my.df$julian.days) Although I'm still in my R learning infancy I am under the impression that x

[R] Coefficient of determination

2009-06-16 Thread Derek An
Dear all, Is there a instruction that can help me obtain the coefficient of determination R^2 after doing linear/nonlinear regression using lm/nls? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Running stats on individual data.frames from the split()function list

2009-06-16 Thread Daniel Malter
This easy function you are looking for is tapply. Take a look at the following example: day=rep(1:30,each=30) ##There are thirty days ##with thirty obs each y=rnorm(length(day),mean=2*day,sd=day) ##a dep. variable ##with mean=2*day index no. ##and sd=day tapply(y,day,length) ##shows no. of obs

  1   2   >