Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread Gabor Grothendieck
Berwin Turlach has pointed out that to be equivalent to the original answer the code should be: plot(a, ylim = range(a) * (1 + 0.06 * c(-1,1))) On Fri, Jan 9, 2009 at 2:22 PM, Gabor Grothendieck wrote: > Or even: > > plot(a, ylim = range(a) + 0.06 * c(-1, 1)) > > > On Fri, Jan 9, 2009 at 2:07 PM

Re: [R] Bubble plot on shapefile - projection issues?

2009-01-09 Thread Roy Mendelssohn
Use the "bubble" command in gstat. -Roy M. On Jan 9, 2009, at 5:58 PM, t c wrote: Dear R help list, I am working on some data from a study on the habitat use and movement patterns of fish using a marine protected area in Hawaii. We have a number of acoustic receivers in a MPA, and any tim

[R] Bubble plot on shapefile - projection issues?

2009-01-09 Thread t c
Dear R help list,   I am working on some data from a study on the habitat use and movement patterns of fish using a marine protected area in Hawaii.  We have a number of acoustic receivers in a MPA, and any time a tagged fish passes within range it records the date and time of detection.  I am t

Re: [R] crash on multiple queries to postgresql db

2009-01-09 Thread Joe Conway
Dylan Beaudette wrote: Subsequent calls to: conn <- dbConnect(PgSQL(), host="localhost", dbname="xxx", user="xxx") query <- dbSendQuery(conn, query_text) res <- dbGetResult(query) are resulting in this: *** glibc detected *** /usr/local/lib/R/bin/exec/R: realloc(): invalid other attache

Re: [R] Matrix: Problem with the code

2009-01-09 Thread markleeds
Thanks Kingsford. I thought the column power was supposed to be just for that column but you're probably correct. English has its oddities because if one reads the actual sentence the person wrote it's still not clear, atleast to me. "Actually I want to have a matrix with p columns such that

Re: [R] Matrix: Problem with the code

2009-01-09 Thread Kingsford Jones
On Fri, Jan 9, 2009 at 6:36 PM, wrote: > Charlotte: I ran your code because I wasn't clear on it and your way would > cause more matrices than the person requested. Bhargab gave us x<-c(23,67,2,87,9,63,8,2,35,6,91,41,22,3) and said: "I want to have a matrix with p columns such that each c

[R] RMySQL CREATE TABLE error

2009-01-09 Thread Anthony Dick
Hi all- I am stumped. The code in A. returns errors at lines 14 and 15 and fails to load series1 and series2. However, in B., if temp1 and temp2 are called again (which returns a "Table exists" error; see lines 14-17 in B.) series1 and series2 load correctly. Any ideas? Also-I am open to any

Re: [R] .Last.value (was )

2009-01-09 Thread John Fox
Dear Sarah and Glenn, > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Sarah Goslee > Sent: January-09-09 7:32 PM > To: glenn > Cc: r-help@r-project.org > Subject: Re: [R] > > Hi Glenn, > > On Fri, Jan 9, 2009 at 7:20 PM, gle

Re: [R] Matrix: Problem with the code

2009-01-09 Thread markleeds
Charlotte: I ran your code because I wasn't clear on it and your way would cause more matrices than the person requested. So I think the code below it, although not too short, does what the person asked. Thanks though because I understand outer better now. temp <- matrix(c(1,2,3,4,5,6),ncol=2)

Re: [R]

2009-01-09 Thread Sarah Goslee
On Fri, Jan 9, 2009 at 7:42 PM, Charlotte Wickham wrote: > .Last.value Oh, right. Thanks. Sarah -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Ashlee Vance's article on R in the New York Times

2009-01-09 Thread hadley wickham
> comparable to S-Plus and SAS, not withstanding Milley's snide comment. But > if you want to attack the chronic and painful productivity problems with > data preparation and statistical table production, you need to go beyond R > and SAS. What are these problems? Hadley -- http://had.co.nz/ _

Re: [R]

2009-01-09 Thread Charlotte Wickham
>> (2) mathematica has a term (%) that when typed means the last returned >> value, so > % + 1 say would return the last outputted value +1 .is there >> an R equivalent please? > > I don't think so - you need to assign that value to something to be able > to reuse it. .Last.value Charlotte ___

Re: [R] Matrix: Problem with the code

2009-01-09 Thread Charlotte Wickham
One of those more elegant ways: outer(x, 1:p, "^") Charlotte On Fri, Jan 9, 2009 at 4:24 PM, Sarah Goslee wrote: > Well, mat doesn't have any dimensions / isn't a matrix, and we don't > know what p is supposed to be. But leaving aside those little details, > do you perhaps want something like th

Re: [R]

2009-01-09 Thread Sarah Goslee
Hi Glenn, On Fri, Jan 9, 2009 at 7:20 PM, glenn wrote: > Very simple questions if anyone can help: > > (1) what is the value in saving workspaces, which is offered at every close? > I thought it might save the set up of the GUI but I cant work out what it > does ­ I run a script that loads the pa

Re: [R] Matrix: Problem with the code

2009-01-09 Thread Sarah Goslee
Well, mat doesn't have any dimensions / isn't a matrix, and we don't know what p is supposed to be. But leaving aside those little details, do you perhaps want something like this: x<-c(23,67,2,87,9,63,8,2,35,6,91,41,22,3) p <- 5 mat<- matrix(0, nrow=p, ncol=length(x)) for(

[R]

2009-01-09 Thread glenn
Very simple questions if anyone can help: (1) what is the value in saving workspaces, which is offered at every close? I thought it might save the set up of the GUI but I cant work out what it does ­ I run a script that loads the packages I need at the start of every session. (2) mathematica has a

Re: [R] create sequences from two "from" and "to" vectors

2009-01-09 Thread Greg Snow
Try: > mapply( seq, from=1:4, to=7:10 ) [,1] [,2] [,3] [,4] [1,]1234 [2,]2345 [3,]3456 [4,]4567 [5,]5678 [6,]6789 [7,]789 10 Is that what you want? -- Gregory (Greg) L. Snow Ph.D.

Re: [R] Maintain Spaces and Parentheses in Variable Names

2009-01-09 Thread Greg Snow
You may also want to look at the label function (and friends) from the Hmisc package. This gives a way to use short, "correct" names for the variables, but have a longer, more descriptive label to use in plots. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare gr

Re: [R] Calculating p-values from your own distribution as an array

2009-01-09 Thread Greg Snow
Try this (replace the 0:9 with your values): > distfun <- approxfun( c(-Inf,0:9), seq(0,1,length=length(0:9)+1), > method='constant', rule=2) > distfun( c(-1,0,3,3.4,4,12) ) Does that do what you want? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@

[R] Matrix: Problem with the code

2009-01-09 Thread Bhargab Chattopadhyay
Hi, Can any one please explain why the following code doesn't work? Or can anyone suggest an alternative. Suppose   x<-c(23,67,2,87,9,63,8,2,35,6,91,41,22,3)    mat<-0;    for(j in 1:length(x))    {      for(i in 1:p)      mat[i,j]<-x[j]^i;    }    A

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Gabor Grothendieck
On Fri, Jan 9, 2009 at 4:28 PM, Wacek Kusnierczyk wrote: > Rau, Roland wrote: >> >> P.S. Any suggestions how to become more proficient with regular >> expressions? The O'Reilly book ("Mastering...")? Whenever I tried >> anything more complicated than basic usage (things like ^ $ * . ) in R, >> I w

[R] crash on multiple queries to postgresql db

2009-01-09 Thread Dylan Beaudette
Hi, Subsequent calls to: conn <- dbConnect(PgSQL(), host="localhost", dbname="xxx", user="xxx") query <- dbSendQuery(conn, query_text) res <- dbGetResult(query) are resulting in this: *** glibc detected *** /usr/local/lib/R/bin/exec/R: realloc(): invalid pointer: 0x0a605de4 *** === Backt

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Gabor Grothendieck
On Fri, Jan 9, 2009 at 4:20 PM, Wacek Kusnierczyk wrote: > >> Duncan Murdoch wrote: >> >>> >>> I'm curious about something: does "file extension" have a standard >>> definition? Most (all? I haven't tried them all) of the solutions >>> presented in this thread would return an empty string for th

Re: [R] The R Inferno

2009-01-09 Thread John Fox
Dear Barry, In Dante's Divine Comedy the sequels were the Purgatorio and the Paradiso; the analogy suggests that there may be a way out of R Hell (and actually Patrick provides the way out right in his Inferno -- thanks Patrick!). Regards, John > -Original Message- > From: r-help-boun.

Re: [R] ftp connections for uploading files

2009-01-09 Thread Duncan Temple Lang
Hi Thomas Rather than getting into the details of libcurl options which are quite general and very flexible, I thought it was easier to write an explicit ftpUpload() function that takes care of the details. You need a new version of the package (as it contains the function and a small change t

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Wacek Kusnierczyk
Rau, Roland wrote: > > P.S. Any suggestions how to become more proficient with regular > expressions? The O'Reilly book ("Mastering...")? Whenever I tried > anything more complicated than basic usage (things like ^ $ * . ) in R, > I was way faster to write a new function (like above) instead of fin

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Wacek Kusnierczyk
> Duncan Murdoch wrote: > >> >> I'm curious about something: does "file extension" have a standard >> definition? Most (all? I haven't tried them all) of the solutions >> presented in this thread would return an empty string for the "plain >> base" if given the filename ".bashrc". >> r

Re: [R] create sequences from two "from" and "to" vectors

2009-01-09 Thread Yasir Kaheil
Great! thank you so much! Dimitris Rizopoulos-4 wrote: > > one way is using mapply(), e.g., > > mapply(":", 1:4, 3:6) > > > I hope it helps. > > Best, > Dimitris > > > Yasir Kaheil wrote: >> hi all, >> how can I create sequences that start from a known vector, say x1 and end >> with anothe

Re: [R] create sequences from two "from" and "to" vectors

2009-01-09 Thread Marc Schwartz
on 01/09/2009 02:42 PM Yasir Kaheil wrote: > hi all, > how can I create sequences that start from a known vector, say x1 and end > with another say x2- also suppose all the sequences will be the same length. > I don't want to use a for loop > x1<-c(1,2,3,4); x2<-(3,4,5,6); > what I want is > 1 2 3

Re: [R] create sequences from two "from" and "to" vectors

2009-01-09 Thread Dimitris Rizopoulos
one way is using mapply(), e.g., mapply(":", 1:4, 3:6) I hope it helps. Best, Dimitris Yasir Kaheil wrote: hi all, how can I create sequences that start from a known vector, say x1 and end with another say x2- also suppose all the sequences will be the same length. I don't want to use a for

[R] create sequences from two "from" and "to" vectors

2009-01-09 Thread Yasir Kaheil
hi all, how can I create sequences that start from a known vector, say x1 and end with another say x2- also suppose all the sequences will be the same length. I don't want to use a for loop x1<-c(1,2,3,4); x2<-(3,4,5,6); what I want is 1 2 3 4 2 3 4 5 3 4 5 6 Thanks - Yasir H. Kaheil Colum

Re: [R] The R Inferno

2009-01-09 Thread Barry Rowlingson
2009/1/9 Duncan Murdoch : > Which he well deserves -- it's good advice, and a fun read too. I'm looking forward to the sequel - Shakespeare perhaps? "as.YouLike(it)"? "Much Ado About NULL"? "Night[12] | What(You.Will)"? Barry __ R-help@r-project.org

Re: [R] The R Inferno

2009-01-09 Thread Duncan Murdoch
On 1/9/2009 1:27 PM, roger koenker wrote: I think that this continuation constitutes what Pat calls "hijacking the thread" at the end of his new and magnificent opus. The original thread should be reserved for kudos to Pat. Which he well deserves -- it's good advice, and a fun read too. D

Re: [R] Ashlee Vance's article on R in the New York Times

2009-01-09 Thread Patrick Connolly
On Thu, 08-Jan-2009 at 01:26AM -0500, Robert Wilkins wrote: [] |> Some R promoters point out that R has lexical scope and lots of |> Scheme goodness. ( and what widespread programming language today |> does not have lexical scope? ). But other R promoters point out |> that programs in S-Plus

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread stephen sefick
WOW, Gabor, that is fancy. I have gotten better at this R thing, but have far to go. That is a neat solution. thanks Stephen On Fri, Jan 9, 2009 at 2:22 PM, Gabor Grothendieck wrote: > Or even: > > plot(a, ylim = range(a) + 0.06 * c(-1, 1)) > > > On Fri, Jan 9, 2009 at 2:07 PM, Mike Prager w

[R] question about the scale in ridge regression of the MASS package

2009-01-09 Thread Xue, Liangjie
Hi I am reading the source code of the ridge regression of the MASS package, and I found the following piece of code X <- model.matrix(Terms, m, contrasts) n <- nrow(X); p <- ncol(X) offset <- model.offset(m) if(!is.null(offset)) Y <- Y - offset if(Inter <- attr(Terms, "interce

Re: [R] Maintain Spaces and Parentheses in Variable Names

2009-01-09 Thread Cloudy56
Thank you very much. That certainly worked. Somehow I did not see that when reading the help file, nor could I find it via Google search so I appreciate your help! -- JC Henrique Dallazuanna wrote: > > Try this: > > read.table(, check.names = FALSE) > > On Fri, Jan 9, 2009 at 3:56 PM,

[R] equation of confidence interval calculated by predict.lm

2009-01-09 Thread kloe
Hello, Sorry to ask this question, I have been searching quite a lot but I could not find an answer. I have seen one post about this subject but I did not really understand the answer. I have a linear regression with 95% confidence interval. I would like to find the x-absciss of the intersection

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread Gabor Grothendieck
Or even: plot(a, ylim = range(a) + 0.06 * c(-1, 1)) On Fri, Jan 9, 2009 at 2:07 PM, Mike Prager wrote: > "stephen sefick" wrote: > >> low <- min(a*0.98)-(min(a)*0.04) >> high <- max(a*1.02)+(max(a)*0.04) >> plot(a, ylim=c(low, high)) > > Unless I am misreading your example, this can be done a

Re: [R] Calling R functions from Python

2009-01-09 Thread culpritNr1
Hello Ryan, I have good and bad news for you. The good one is that there is a new rpy in active development. The bad one is that you should compile it yourself. You can get it here http://rpy.sourceforge.net/rpy2.html I use the regular distro of rpy under Linux x86_64. It works. I hope you ge

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread Mike Prager
"stephen sefick" wrote: > low <- min(a*0.98)-(min(a)*0.04) > high <- max(a*1.02)+(max(a)*0.04) > plot(a, ylim=c(low, high)) Unless I am misreading your example, this can be done a little more compactly as: plot(a, ylim = range(a * 0.94, a * 1.06)) -- Mike Prager, NOAA, Beaufort, NC * Opinions

Re: [R] longtable example

2009-01-09 Thread Dieter Menne
Felipe Carrillo yahoo.com> writes: > One thing that I noticed though, when I generated my pdf > all the pages had different numbers of rows, for example page 1 had 24 rows,second page 15 rows,third page 2 > rows of data. Is that something that can be controlled with pagebreaks? I darkly rememb

Re: [R] longtable example

2009-01-09 Thread Felipe Carrillo
Thanks Dieter: It's exactly what I want. Thanks a lot for you help. One thing that I noticed though, when I generated my pdf all the pages had different numbers of rows, for example page 1 had 24 rows,second page 15 rows,third page 2 rows of data. Is that something that can be controlled with p

Re: [R] The R Inferno

2009-01-09 Thread roger koenker
I think that this continuation constitutes what Pat calls "hijacking the thread" at the end of his new and magnificent opus. The original thread should be reserved for kudos to Pat. url:www.econ.uiuc.edu/~rogerRoger Koenker emailrkoen...@uiuc.eduDepartment of

Re: [R] Maintain Spaces and Parentheses in Variable Names

2009-01-09 Thread Henrique Dallazuanna
Try this: read.table(, check.names = FALSE) On Fri, Jan 9, 2009 at 3:56 PM, Cloudy56 wrote: > > Is there any way to maintain spaces, slashes, and parentheses in variable > names when reading these into R? > > Of course, read.table converts these to periods. However, I know that it's > not

[R] Maintain Spaces and Parentheses in Variable Names

2009-01-09 Thread Cloudy56
Is there any way to maintain spaces, slashes, and parentheses in variable names when reading these into R? Of course, read.table converts these to periods. However, I know that it's not strictly illegal to have these characters in variable names as I am able to add them using the "variable edito

[R] bug in R2WinBUGS

2009-01-09 Thread John Smith
In newest version of R2WinBUGS, the default directory is changed to working.directory, but never changed back once finished bugs call. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinf

Re: [R] longtable example

2009-01-09 Thread Dieter Menne
Felipe Carrillo wrote: > > This is what I got. > > \documentclass[11pt]{article} > \usepackage{longtable,lscape} > \usepackage{accents} > \usepackage[usenames,dvipsnames]{color} % load all the colors > \title{\color{Blue}How to transfer column names and add captions to pages > in document} > .

Re: [R] The R Inferno

2009-01-09 Thread Andrew Choens
> now if only i could get tips to sort a 5 column * 1 million rows dataset in > less than ..eternity May I suggest mySQL, postgreSQL, etc.? If what you need to do is a basic sort, a database is going to be faster than R. -- Insert something humorous here. :-)

Re: [R] How to compute Bootstrap p-values

2009-01-09 Thread Murray Cooper
Do you really need the p-value or do you want to test at one of the socially acceptable levels (i.e. .05 or .01). If all you want is the test, use: quantile(bootsample,c(0.025,0.975)) If the quantile range includes 0 then you decide there is no evidence that the mean is different from zero, at t

Re: [R] The R Inferno

2009-01-09 Thread Peter Dalgaard
Ajay ohri wrote: excellent adaptation of Dante and R with real common sense tips to help beginners especially ..goes to the blogroll.. now if only i could get tips to sort a 5 column * 1 million rows dataset in less than ..eternity Er, that's a fairly short eternity: > x <- data.frame

[R] Calling R functions from Python

2009-01-09 Thread ryan
All- Thanks in advance for your help. I'm trying to call R function using Python in a windows environment and have downloaded the Rpy library however it doesn't appear to work with R 2.7.2. Does anyone know if a new version of Rpy exists for windows that will work with R an

Re: [R] The R Inferno

2009-01-09 Thread Ajay ohri
excellent adaptation of Dante and R with real common sense tips to help beginners especially ..goes to the blogroll.. now if only i could get tips to sort a 5 column * 1 million rows dataset in less than ..eternity Ajay www.decisionstats.com On Fri, Jan 9, 2009 at 9:44 PM, Patrick Burns

[R] Calculating p-values from your own distribution as an array

2009-01-09 Thread Stephen Montgomery
Hi - If I have a hypothetical distribution as an array distribution<-c(0,1,2,3,4,5,6,7,8,9) and I want to find the probability there is a value smaller than a new value. new_value<-4 (such that I'd get this type of output) new_value p-value 4 0.5 3.4 0.4 3 0.4 0

Re: [R] Pack and Unpack Strings in R

2009-01-09 Thread jim holtman
see: http://www.nabble.com/Compressing-String-in-R-td21160453.html On Fri, Jan 9, 2009 at 10:50 AM, Gundala Viswanath wrote: > Dear all, > > Does R has any function/package that can pack > and unpack string into bit size? > > The reason I want to do this in R is that R > has much more native sta

[R] The R Inferno

2009-01-09 Thread Patrick Burns
"The R Inferno" is now on the Burns Statistics website at http://www.burns-stat.com/pages/Tutor/R_inferno.pdf Abstract: If you are using R and you think you're in hell, this is a map for you. Also, I've expanded the outline concerning R on the Burns Statistics 'Links' page. Suggestions (off-lis

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Marc Schwartz
on 01/09/2009 09:00 AM Duncan Murdoch wrote: > On 1/8/2009 9:10 PM, Gundala Viswanath wrote: >> Dear all, >> >> The basename() function returns the extension also: >> >>> myfile <- "path1/path2/myoutput.txt" >>> basename(myfile) >> [1] "myoutput.txt" >> >> >> Is there any other function where it ju

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Peter Dalgaard
Duncan Murdoch wrote: > On 1/8/2009 9:10 PM, Gundala Viswanath wrote: >> Dear all, >> >> The basename() function returns the extension also: >> >>> myfile <- "path1/path2/myoutput.txt" >>> basename(myfile) >> [1] "myoutput.txt" >> >> >> Is there any other function where it just returns >> plain bas

Re: [R] Pack and Unpack Strings in R

2009-01-09 Thread Martin Morgan
Gundala -- Gundala Viswanath wrote: Dear all, Does R has any function/package that can pack and unpack string into bit size? All of your questions relate to DNA strings. The R/Bioconductor package Biostrings is designed to manipulate such objects. It does not necessarily address this partic

Re: [R] AT&T Researchers and the New York Times

2009-01-09 Thread David M Smith
On Thu, Jan 8, 2009 at 5:58 PM, Robert Wilkins wrote: > Is anyone in the leadership of the R-project going to contact the New > York Times and clarify that the article gave remarkably short shrift > to the people who designed the user interface for R, to a large extent > AT&T researchers from an e

Re: [R] Pack and Unpack Strings in R

2009-01-09 Thread Henrique Dallazuanna
Try this: ## 1 map <- list(A = '00', C = '01', G = '10', T = '11') myStr <- 'GATTA' paste(map[unlist(strsplit(myStr, NULL))], collapse = "") ## 2 cod <- "100000" library(gsubfn) strapply(cod, '[0-9]{2}') names(map)[match(unlist(strapply(cod, '[0-9]{2}')), map)] On Fri, Jan 9, 2009 at 1:50 P

Re: [R] a first opinion on rattle

2009-01-09 Thread Gabriel Ibarra
Graham: OK. Just give me a few days and I will be sending you some simple RVM code lines. However, you have the Kernlab help with some nice examples   Best regards   Dr. Gabriel Ibarra-Berastegi University of the Basque Country SPAIN --- El vie, 9/1/09, Graham Williams escribió: De: Graham

Re: [R] [R} how to build TermDocMatrix in tm text mining package of R

2009-01-09 Thread Tony Breyal
Hi there, I think something like the following is what you want: ### R start... # if you put your plain text files in a folder like this my.path <- 'C:\\Documents and Settings\\tony\\Desktop\\texts\\' # then you can construct a simple tdm like this library(tm) my.corpus <- Corpus(DirSource(my.pat

Re: [R] longtable example

2009-01-09 Thread Felipe Carrillo
This is what I got. \documentclass[11pt]{article} \usepackage{longtable,lscape} \usepackage{accents} \usepackage[usenames,dvipsnames]{color} % load all the colors \title{\color{Blue}How to transfer column names and add captions to pages in document} \begin{document} \maketitle I am using Sweave a

Re: [R] grep : escape "*"

2009-01-09 Thread David Hajage
oooups. Thank you very much. 2009/1/9 Duncan Murdoch > On 1/9/2009 10:38 AM, David Hajage wrote: > >> Dear R useRs, >> >> Sorry for this foolish question, but I can't find how to escape the * >> character when using grep : >> > > You use a backslash to escape the *. Unfortunately, to enter a ba

Re: [R] recursive relevel

2009-01-09 Thread baptiste auguie
Thanks Thierry, A quick test shows almost equivalent timing with the modification of relevel() suggested earlier: 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 existi

Re: [R] grep : escape "*"

2009-01-09 Thread Tony Breyal
Hi there, you probably want something like: # R grep("\\*", c("/3", "2*3", "4-4")) hope that helps a little, Tony Breyal On 9 Jan, 15:38, "David Hajage" wrote: > Dear R useRs, > > Sorry for this foolish question, but I can't find how to escape the * > character when using grep : > > > grep("

Re: [R] grep : escape "*"

2009-01-09 Thread Gábor Csárdi
* must be escaped for grep with \ and \ must be escaped for R itself with another \, so you need grep("\\*", c("/3", "2*3", "4-4")) Gabor 2009/1/9 David Hajage : > Dear R useRs, > > Sorry for this foolish question, but I can't find how to escape the * > character when using grep : > >> grep("-",

Re: [R] grep : escape "*"

2009-01-09 Thread Gabor Grothendieck
Use fixed = TRUE argument to grep. 2009/1/9 David Hajage : > Dear R useRs, > > Sorry for this foolish question, but I can't find how to escape the * > character when using grep : > >> grep("-", c("/3", "2*3", "4-4")) > [1] 3 >> grep("/", c("/3", "2*3", "4-4")) > [1] 1 >> grep("*", c("/3", "2*3", "

Re: [R] grep : escape "*"

2009-01-09 Thread Henrique Dallazuanna
Use double backslashes: grep("\\*", c("/3", "2*3", "4-4")) 2009/1/9 David Hajage > Dear R useRs, > > Sorry for this foolish question, but I can't find how to escape the * > character when using grep : > > > grep("-", c("/3", "2*3", "4-4")) > [1] 3 > > grep("/", c("/3", "2*3", "4-4")) > [1] 1 >

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Gabor Grothendieck
On Fri, Jan 9, 2009 at 10:23 AM, Rau, Roland wrote: > Hi, > >> [mailto:r-help-boun...@r-project.org] On Behalf Of Henrique >> Dallazuanna >> >> Try this also: >> >> substr(basename(myfile), 1, nchar(basename(myfile)) - 4) >> > > This, of course, assumes that the extensions are always 3 characters.

[R] Pack and Unpack Strings in R

2009-01-09 Thread Gundala Viswanath
Dear all, Does R has any function/package that can pack and unpack string into bit size? The reason I want to do this in R is that R has much more native statistical function than Perl. Yet the data I need to process is so large that it required me to compress it into smaller unit -> process it

Re: [R] AT&T Researchers and the New York Times

2009-01-09 Thread Ajay ohri
R would have truly arrived if the Wall Street Journal mentions it as an alternative to SAS or Excel...but that is some years away... Ajay www.decisionstats.com On Fri, Jan 9, 2009 at 7:28 AM, Robert Wilkins wrote: > Is anyone in the leadership of the R-project going to contact the New > York Tim

Re: [R] grep : escape "*"

2009-01-09 Thread Duncan Murdoch
On 1/9/2009 10:38 AM, David Hajage wrote: Dear R useRs, Sorry for this foolish question, but I can't find how to escape the * character when using grep : You use a backslash to escape the *. Unfortunately, to enter a backslash in an R string, you need to escape it. So the pattern is "\\*".

[R] grep : escape "*"

2009-01-09 Thread David Hajage
Dear R useRs, Sorry for this foolish question, but I can't find how to escape the * character when using grep : > grep("-", c("/3", "2*3", "4-4")) [1] 3 > grep("/", c("/3", "2*3", "4-4")) [1] 1 > grep("*", c("/3", "2*3", "4-4")) Erreur dans grep("*", c("/3", "2*3", "4-4")) : expression régulièr

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Rau, Roland
Hi, > [mailto:r-help-boun...@r-project.org] On Behalf Of Henrique > Dallazuanna > > Try this also: > > substr(basename(myfile), 1, nchar(basename(myfile)) - 4) > This, of course, assumes that the extensions are always 3 characters. Sometimes there might be more ("index.html"), sometimes less

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Duncan Murdoch
On 1/8/2009 9:10 PM, Gundala Viswanath wrote: Dear all, The basename() function returns the extension also: myfile <- "path1/path2/myoutput.txt" basename(myfile) [1] "myoutput.txt" Is there any other function where it just returns plain base: "myoutput" i.e. without 'txt' I'm curious ab

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Henrique Dallazuanna
Right, Other option is: substr(nameFile, 1, tail(unlist(gregexpr("\\.", nameFile)), 1) - 1) On Fri, Jan 9, 2009 at 1:23 PM, Rau, Roland wrote: > Hi, > > > [mailto:r-help-boun...@r-project.org] On Behalf Of Henrique > > Dallazuanna > > > > Try this also: > > > > substr(basename(myfile), 1, nc

[R] AT&T Researchers and the New York Times

2009-01-09 Thread Gábor Csárdi
On Fri, Jan 9, 2009 at 1:45 PM, Roland Studer wrote: > I agree, that there are better plattforms. > I'd love to see something like Stack Overflow: > http://stackoverflow.com/ Why, you cannot see it now? You can start posting your R questions and answers to it right away if you like. > When you t

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread stephen sefick
WOW, I am not going to post after midnight. Thank you for your response, and this is what I settled on. `plot.e` <- function(b, w, x, y, z){ a <- window.chron(b, w, x, y, z) low <- min(a*0.98)-(min(a)*0.04) high <- max(a*1.02)+(max(a)*0.04) plot(a, ylim=c(low, high)) lines(a*0.98, col="blue") lin

Re: [R] recursive relevel

2009-01-09 Thread ONKELINX, Thierry
Dear Baptiste, You can avoid the recursive stuff. And it will run about twice as fast. > order.factor <- function (x, ref) + { + last.index <- length(ref) # convenience for matlab's end keyword + if(last.index == 1) return(relevel(x, ref)) # end case, normal case + my.new.list <- list(x=re

Re: [R] recursive relevel

2009-01-09 Thread baptiste auguie
On 9 Jan 2009, at 15:26, Dimitris Rizopoulos wrote: I think that you can still use to core of stats:::relevel.factor; the only thing that needs to be changed is the controls for bad values of the 'ref' argument, i.e., relevelNew <- function (x, ref, ...) { lev <- levels(x) if (is.chara

[R] snow and different R versions

2009-01-09 Thread Gábor Csárdi
Dear Luke and others, I have many R versions on my machine and want to start a particular one when snow builds its cluster. (The same version I start snow from.) It seems that everything is set up correctly in defaultClusterOptions: > mget(ls(defaultClusterOptions), defaultClusterOptions) $homoge

Re: [R] recursive relevel

2009-01-09 Thread Dimitris Rizopoulos
I think that you can still use to core of stats:::relevel.factor; the only thing that needs to be changed is the controls for bad values of the 'ref' argument, i.e., relevelNew <- function (x, ref, ...) { lev <- levels(x) if (is.character(ref)) ref <- match(ref, lev) if (any

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Berwin A Turlach
G'day Wacek, On Fri, 09 Jan 2009 15:19:46 +0100 Wacek Kusnierczyk wrote: > i think i did not suggest the original poster to learn perl. As I see it, you didn't suggest anything to the original poster, at least not directly. But, since these days you have to be subscribed to r-help to post IIRC

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Wacek Kusnierczyk
Prof Brian Ripley wrote: > > Actually, that's a valid regex in any of the variants offered. A more > conventional writing of it is the second of > >> f <- 'foo.bar.R' >> sub("[.][^.]*$", "", f) > [1] "foo.bar" >> sub("\\.[^.]*$", "", f) > [1] "foo.bar" > more conventional in r, perhaps. it's not

[R] [R} how to build TermDocMatrix in tm text mining package of R

2009-01-09 Thread Kum-Hoe Hwang
Howdy Gurus I 'd like to ask a question about how to build TermDocMatrix in tm text mining package. It is not clear about importing a plain text file, and them converting that text file into TermDocMatrix file, etc to me. How can I build a TermDocMatrix of " a plain text document file for text as

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Wacek Kusnierczyk
Berwin A Turlach wrote: > G'day Wacek, > > On Fri, 09 Jan 2009 14:22:19 +0100 > Wacek Kusnierczyk wrote: > > >>> Apparently also a possibility, I guess it can be made to work with >>> the original example and my extensions. >>> >>> >> i guess it does work with the original example and

[R] recursive relevel

2009-01-09 Thread baptiste auguie
Dear list, I'm having second thoughts after solving a very trivial problem: I want to extend the relevel() function to reorder an arbitrary number of levels of a factor in one go. I could not find a trivial way of using the code obtained by getS3method("relevel","factor"). Instead, I thou

[R] rpart with interval censored data crashes R

2009-01-09 Thread Keith Jewell
Hi Everyone, This example code results in R 'crashing'; that is the R application closes with no warnings or error messages. #--- myD <- read.table(stdin(), header=TRUE, nrows=20) Broth Salt pH TempN Y Growth 13109.0 2.92 10 90.0 NA0 2

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Prof Brian Ripley
On Fri, 9 Jan 2009, Berwin A Turlach wrote: G'day Wacek, On Fri, 09 Jan 2009 12:52:46 +0100 Wacek Kusnierczyk wrote: Berwin A Turlach wrote: G'day all, On Fri, 9 Jan 2009 08:12:18 -0200 "Henrique Dallazuanna" wrote: Try this also: substr(basename(myfile), 1, nchar(basename(myfile)) -

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Berwin A Turlach
G'day Wacek, On Fri, 09 Jan 2009 14:22:19 +0100 Wacek Kusnierczyk wrote: > > Apparently also a possibility, I guess it can be made to work with > > the original example and my extensions. > > > > i guess it does work with the original example and your extensions. And I thought that you woul

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Wacek Kusnierczyk
Berwin A Turlach wrote: > G'day Wacek, > > > >>> Or, in case that the extension has more than three letters or >>> "myfile" is a vector of names: >>> >>> R> myfile <- "path1/path2/myoutput.txt" >>> R> sapply(strsplit(basename(myfile),"\\."), function(x) >>> R> paste(x[1:(length(x)-1)], collapse=

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Berwin A Turlach
G'day Wacek, On Fri, 09 Jan 2009 12:52:46 +0100 Wacek Kusnierczyk wrote: > Berwin A Turlach wrote: > > G'day all, > > > > On Fri, 9 Jan 2009 08:12:18 -0200 > > "Henrique Dallazuanna" wrote: > > > > > >> Try this also: > >> > >> substr(basename(myfile), 1, nchar(basename(myfile)) - 4) > >>

Re: [R] AT&T Researchers and the New York Times

2009-01-09 Thread Dr Eberhard W Lisse
No problem, easy peasy, just hack it together and put all the old archives on so the subscribers can vote. greetings, el On 09 Jan 2009, at 14:45 , Roland Studer wrote: I agree, that there are better plattforms. I'd love to see something like Stack Overflow: http://stackoverflow.com/ When you

Re: [R] AT&T Researchers and the New York Times

2009-01-09 Thread Roland Studer
I agree, that there are better plattforms. I'd love to see something like Stack Overflow: http://stackoverflow.com/ When you type your question, it compares it to previously answered questions. Answers can get voted up and down. Answers AND questions can be edited! Regards Roland Studer On Fri

Re: [R] Saving plots as byte streams

2009-01-09 Thread Prof Brian Ripley
On Fri, 9 Jan 2009, richard.cot...@hsl.gov.uk wrote: Is it possible to save plots as byte streams? You mean bitmap plots? E.g. PDF plots are not even written sequentially. For example, if I want the bytes for a PNG plot, I could use #Write the plot to a PNG file png("test.png") plot(1:10

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Wacek Kusnierczyk
Gabor Grothendieck wrote: > On Fri, Jan 9, 2009 at 6:52 AM, Wacek Kusnierczyk > > >> or have sub do the job for you: >> >> filenames.ext = c("foo.bar", basename("foo/bar/hello.dolly")) >> (filenames.noext = sub("[.][^.]*$", "", filenames.ext, perl=TRUE)) >> > > We can omit perl = TRUE here.

[R] Moving Legend Location for a Stacked Histogram

2009-01-09 Thread Jason Rupert
Thank you again for your response.   This worked great.   Quick question about the legend for qplot.  Instead of being outside the plot, is it possible to move the location of the legend to the upper left or right corner of the plot?  Could you possibly provide an example.   Thank you again for

Re: [R] Extracting File Basename without Extension

2009-01-09 Thread Gabor Grothendieck
On Fri, Jan 9, 2009 at 6:52 AM, Wacek Kusnierczyk wrote: > Berwin A Turlach wrote: >> G'day all, >> >> On Fri, 9 Jan 2009 08:12:18 -0200 >> "Henrique Dallazuanna" wrote: >> >> >>> Try this also: >>> >>> substr(basename(myfile), 1, nchar(basename(myfile)) - 4) >>> >> >> Or, in case that the extens

  1   2   >