Re: [R] strange split behavior?

2009-09-23 Thread Philipp Pagel
On Wed, Sep 23, 2009 at 07:29:30AM -0500, Peng Yu wrote: > On Wed, Sep 23, 2009 at 1:24 AM, Peter Dalgaard > wrote: > > Peng Yu wrote: > > Is there an operation on a factor to get a subset and keep only the > corresponding levels (see commented line below)? Yes, there is: call factor() on your s

Re: [R] graduation

2009-09-23 Thread David Winsemius
On Sep 23, 2009, at 4:54 AM, MKHABELA,SN wrote: Hi everyone I want help in graduating the attached rates and checking for goodness of fit and smoothness using R please help. females.txt>__ You have provided the rates but not the death counts or

Re: [R] retrieve certain part from html

2009-09-23 Thread Henrique Dallazuanna
Try using XML package: Lines <- "2005-012006-012007-012008-012009-01" library(XML) xpathApply(htmlParse(Lines), "//a", xmlAttrs) On Wed, Sep 23, 2009 at 9:29 AM, Rene wrote: > Dear All, > > > > Can someone please guide me how to get the certain part from a long html > language? > > > > e.g. > >

[R] Reading data

2009-09-23 Thread Ashta
Dear R-users, I am a new user for R. I am eager to lean about it. I wanted to read and summary of the a simple data file I used the following, rel <- read.table("C:/Documents and Settings/ashta/My Documents/R_data/rel.dat", quote="",header=FALSE,sep="",col.names= c("id","orel","nrel

Re: [R] Problem in graph plotting

2009-09-23 Thread baptiste auguie
Hi, It's trivial with ggplot2, library(ggplot2) qplot(tp,dp, geom="line") + scale_y_reverse() HTH, baptiste 2009/9/23 David Winsemius : > > On Sep 23, 2009, at 7:58 AM, FMH wrote: > >> Dear All, >> >> Let: >> dp: depth of the river >> tp: temperature with respect to depth >> >> We can have a s

Re: [R] retrieve certain part from html

2009-09-23 Thread Romain Francois
Hi, The R4X package can help you. (I have wrapped your td's into one tr) > x <- xml( "2005-012006-012007-012008-012009-01" ) > x["td/a/#"] tdtdtdtdtd "2005-01" "2006-01" "2007-01" "2008-01" "2009-01" > x["td/a/@href"] td td

Re: [R] Problem in graph plotting

2009-09-23 Thread Jim Lemon
On 09/23/2009 09:58 PM, FMH wrote: Dear All, Let: dp: depth of the river tp: temperature with respect to depth We can have a simple scatter plot, between depth as y-axis and temperature as x-axis, by using a plot function as shown below. # dp<- c(1,4,3,2,5,7,9,8,9,2) tp<

Re: [R] reading web log file into R

2009-09-23 Thread Jay Emerson
Sebastian, There is rarely a completely free lunch, but fortunately for us R has some wonderful tools to make this possible. R supports regular expressions with commands like grep(), gsub(), strsplit(), and others documented on the help pages. It's just a matter of constructing and algorithm tha

Re: [R] retrieve certain part from html

2009-09-23 Thread Rene
Dear All, Can someone please guide me how to get the certain part from a long html language? e.g. "2005-012006-012007-012008-012009-01" How to get only the wording of "2005-01.html", "2006-01.html", "2007-01.html"," 2008-01.html"," 2009-01.html" from the above html code? I have tr

Re: [R] strange split behavior?

2009-09-23 Thread Peng Yu
On Wed, Sep 23, 2009 at 1:24 AM, Peter Dalgaard wrote: > Peng Yu wrote: >> >> Hi, >> >> Please see the command with a comment below. I don't find >> 'A630039F22Rik' in y. But 'A630039F22Rik' is in z. Can somebody let me >> know what the problem is? > > Most obvious guess is that your  factor y has

Re: [R] Sorting

2009-09-23 Thread baptiste auguie
yet another way, > x <- read.table(textConnection("Category Value + b1 + b2 + a7 + a1"), header=TRUE) > y = transform(x, Category = relevel(Category, c("b"))) > str(y) 'data.frame': 4 obs. of 2 variables: $ Category: Facto

Re: [R] reading web log file into R

2009-09-23 Thread jim holtman
Here is a way to do it. I assume that you data has each record on a line; it came through the email as multiple lines. > x <- readLines("/tempxx.txt") > # remove '#Fields:" so it can be used as a header > x <- sub("^#Fields: ", "", x) > # remove comment lines > x <- x[-grep("^#", x)] > # remove

Re: [R] Problem in graph plotting

2009-09-23 Thread David Winsemius
On Sep 23, 2009, at 7:58 AM, FMH wrote: Dear All, Let: dp: depth of the river tp: temperature with respect to depth We can have a simple scatter plot, between depth as y-axis and temperature as x-axis, by using a plot function as shown below. # dp <- c(1,4,3,2,5,7,9,8,

Re: [R] use of class variable in r as in Proc means of sas

2009-09-23 Thread premmad
Ya it works thanks for the help -- View this message in context: http://www.nabble.com/use-of-class-variable-in-r-as-in-Proc-means-of-sas-tp25530654p25531102.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

Re: [R] Sorting

2009-09-23 Thread jim holtman
Here is a way of doing it > x <- read.table(textConnection("Category Value + b1 + b2 + a7 + a1"), header=TRUE, as.is=TRUE) > # now keep level in original order > x$Category <- factor(x$Category, levels=unique(x$Category)) > str(x)

Re: [R] Sorting

2009-09-23 Thread Henrique Dallazuanna
Try this: DF$Category <- factor(DF$Category, levels = c("b", "a")) On Wed, Sep 23, 2009 at 4:16 AM, Chris Li wrote: > > Hello, > > Say I have a dataset as followed: > > Category     Value > b                1 > b                2 > a                7 > a                1 > > Then, if I: > > leve

Re: [R] Problem in graph plotting

2009-09-23 Thread jim holtman
try this: plot(tp,dp, type= 'l',ylim=rev(range(dp))) On Wed, Sep 23, 2009 at 7:58 AM, FMH wrote: > Dear All, > > Let: > dp: depth of the river > tp: temperature with respect to depth > > We can have a simple scatter plot, between depth as y-axis and temperature as > x-axis, by using a plot fu

[R] Problem in graph plotting

2009-09-23 Thread FMH
Dear All, Let: dp: depth of the river tp: temperature with respect to depth We can have a simple scatter plot, between depth as y-axis and temperature as x-axis, by using a plot function as shown below. #  dp <- c(1,4,3,2,5,7,9,8,9,2) tp <- 1:10 plot(tp,dp, type= 'l') #

Re: [R] use of class variable in r as in Proc means of sas

2009-09-23 Thread Girish A.R.
See if this works: qfun2 <- function(x, digits=3,sci=F,...){ c(q=quantile(x, probs=c(1,5,10,95,99)/100,type=6,...) ) } cheers, -Girish === premmad wrote: > > I tried thanks for your help and got the same result for percentile 5 & 95 > as in SAS.But if i need to calcu

Re: [R] Evaluating expresssions as parameter values

2009-09-23 Thread Peter Ehlers
Can't you just use get()? What am I missing? f <- function(fo, data, groups) { g <- xyplot(as.formula(fo), groups = get(groups), data) print(g) } f("yield ~ variety | site", data = barley, groups = "year") Peter Ehlers Erich Neuwirth wrote: Thanks, that completely solves the

Re: [R] glm analysis repeated for 900 variables

2009-09-23 Thread Christian Schulz
Hi, nvars <- 902 data <- as.data.frame(matrix(runif(100*nvars),ncol=nvars)) colnames(data)[901] <- c('phenotype') colnames(data)[902] <- c('outcome') ### catch all aic values ### res <- matrix(nrow=900,ncol=2) for (i in 1:(length(data)-2)) { res[i,1] <- names(data)[i] res[i,2] <- glm(outco

Re: [R] run R script automatically by double-clicking WinXP desktopicon

2009-09-23 Thread Franzini, Gabriele [Nervianoms]
Hello Chris, I had the same problem, and I ended up driving R Gui through an Autoit script, see http://www.autoitscript.com/autoit3/ Regards, Gabriele Franzini -Original Message- From: cr...@binghamton.edu [mailto:cr...@binghamton.edu] Sent: 22 September 2009 19:37 To: r-help@r-project.o

Re: [R] use of class variable in r as in Proc means of sas

2009-09-23 Thread ONKELINX, Thierry
You might need to change the type quantile. The default is type = 7, whereas default for SAS is type = 3 and for SPSS type = 6. Have a look at the helpfile of quantile() for more details on the type. HTH, Thierry ir.

[R] graduation

2009-09-23 Thread MKHABELA,SN
Hi everyone I want help in graduating the attached rates and checking for goodness of fit and smoothness using R please help. Many thnk TOo every one around the world This message and attachments are subject to a disclaimer. Please refer to www.it.up.ac.za/documentation/governance/disclaimer

Re: [R] use of class variable in r as in Proc means of sas

2009-09-23 Thread premmad
I tried thanks for your help and got the same result for percentile 5 & 95 as in SAS.But if i need to calculate quantiles (1,5,10,99,etc.) it will not be possible with fivenum as explained in the help page .If i need those quantiles what is the change i need to make in the function qfu<-function(

Re: [R] Semi continous variable- define bounds using lpsolve

2009-09-23 Thread pragathichi
thank a lot it works Hans W. Borchers wrote: > > But of course, it is always possible to emulate a semi-continuous variable > by introducing a binary variable and use some "big-M" trick. That is, with > a new binary variable b we add the following two conditions: > > x3 - 3.6 * b >= 0 and

Re: [R] use of class variable in r as in Proc means of sas

2009-09-23 Thread premmad
Thanks for the help.I got the required quantiles by altering ur code as follows qfu<-function(x,digits=3,sci=F,...) {c(q=quantile(x,probs=c(5,90)/100)) } and my result of the R system is different from my sas system output for the same function .could anyone help me in this and what is the rea

[R] Sorting

2009-09-23 Thread Chris Li
Hello, Say I have a dataset as followed: Category Value b1 b2 a7 a1 Then, if I: levels(Category) It will return: [a], [b] But I want to keep the original order, i.e.: [b], [a] Is it possible to do it in R? Thanks in advanc

Re: [R] Ford Fulkerson

2009-09-23 Thread stefano iacus
one implementation is in the optmatch package as far as I remember stefano On 23/set/09, at 03:37, shuva gupta wrote: Hi, Is there any R implementation of the well-known algorithm from the Operations Research literature, the Ford-Fulkerson algorithm of maximum flow in networks with capaciti

Re: [R] Variable as a filename

2009-09-23 Thread baptiste auguie
Hi, The short answer would be ?paste (as in paste(year, ".csv", sep="") ), but I'd suggest you try this instead, lf <- list.files(pattern = ".csv") lf # [1] "2003.csv" "2004.csv" "2005.csv" ln <- gsub(".csv", "", lf) ln # [1] "2003" "2004" "2005" length(ln) lapply(lf, read.csv) ?list.files

[R] Variable as a filename

2009-09-23 Thread Lucas Sevilla García
Hi R community, I have a question. I have 5 files in a directory. Each file has a year as a name (file 1 ->2004, file 2-> 2005, ...). I want to build a for loop where I call first file, do some calculations, go to second file, do some calculations, etc. Somethin like this: year<-2003 nfiles <-

Re: [R] use of class variable in r as in Proc means of sas

2009-09-23 Thread Girish A.R.
Replace your qfu as follows: qfu <- function(x, digits=3,sci=F,...){ c(q=fivenum(x, ...) ) } Look up fivenum function for more information. cheers, -Girish = premmad wrote: > > Thanks for the help.I got the required quantiles by altering ur code > as follows > > q

Re: [R] Handling missing data

2009-09-23 Thread Dr. S. B. Nguah
Reproducible code.??? premmad wrote: > > I have to remove missing data both in character and numeric datatype.I > tried using NA condition but it is not working ,please help me to solve > this. > - Blay S KATH Kumasi, Ghana. -- View this message in context: http://www.nabble.com/Han

Re: [R] Ford Fulkerson

2009-09-23 Thread Gábor Csárdi
Hi, with a different (faster) algorithm, but maximum flows are implemented in package igraph, although for some networks only calculating the flow value is supported, giving the flow itself is not. Best, Gabor On Wed, Sep 23, 2009 at 3:37 AM, shuva gupta wrote: > Hi, > Is there any R implementa

[R] Odp: Sum of Product in a Matrix

2009-09-23 Thread Petr PIKAL
Hi I am not sure if I understand what you want but if your matrix is not so big you can try > x[,1]*x[,2] [1] 5 12 21 32 > cumsum(x[,1]*x[,2]) [1] 5 17 38 70 > and than check value of cumsum according to your condition. Regards Petr r-help-boun...@r-project.org napsal dne 23.09.2009 05:25

<    1   2