Re: [R] grep for strings

2010-12-05 Thread sayan dasgupta
Hi Santosh, you may also try require(stringr) x - abcdefghijklcd str_locate_all(x,cd) On Sun, Dec 5, 2010 at 1:21 PM, Petr Savicky savi...@cs.cas.cz wrote: On Sun, Dec 05, 2010 at 08:04:08AM +0530, Santosh Srinivas wrote: I am trying to find the function where I can search for a pattern

Re: [R] Help with diff(sqrt()) function in terms of time series

2010-12-05 Thread Dieter Menne
Addi Wei wrote: year10 is the time series data set below 11.64 11.50 11.49 ...I tried my best to produce actual code. Please post str(year10). Dieter -- View this message in context:

[R] Automatic reprinting in base graphics when resizing device - how?

2010-12-05 Thread Mark Heckmann
Dear R-users, I want to write a class that reprints automatically when the device is resized. Using grid graphics this can be achieved e.g. by setting the drawDetails method for a grob which is called automatically when the device has changed. Grid graphics are too slow for my application and

[R] Help with time varying covariate-unfold function

2010-12-05 Thread Mathangi Gopalakrishnan
Hello All, I am trying to use the unfold function in RcmdrPlugin.survival library, which converts the survival data with time varying covariates to the counting process notation. The problem is somehow, the event indicator created is not correct. Below is the data, I am trying to convert:

Re: [R] The behaviour of read.csv().

2010-12-05 Thread Duncan Murdoch
On 03/12/2010 7:08 AM, Duncan Murdoch wrote: On 02/12/2010 9:59 PM, Rolf Turner wrote: On 3/12/2010, at 3:48 PM, David Scott wrote: On 03/12/10 14:33, Duncan Murdoch wrote: SNIP I think the fill=TRUE option arrived about 10 years ago, in R 1.2.0. The comment in the NEWS file

[R] foreach question

2010-12-05 Thread Santosh Srinivas
Hello Group, I am experimenting with parallel processing ... here is part of my code. require(snow) require(doSNOW) require(foreach) cl.tmp = makeCluster(rep(localhost,4), type=SOCK) registerDoSNOW(cl.tmp) foreach(i=1:NROW(sDat),.packages=gdata,.verbose=TRUE) %dopar% { do something 1

[R] merging two vectors

2010-12-05 Thread ram basnet
Dear R users,   It may be very simple but it is being difficult for me. I have two vectors with some common string. And, i want to combine into a vector in such a way that it includes string from both vectors and make a unique.   For example:   x - paste(rep(A,5),1:5,sep = .) x [1] A.1 A.2 A.3

Re: [R] merging two vectors

2010-12-05 Thread Duncan Murdoch
On 05/12/2010 9:57 AM, ram basnet wrote: Dear R users, It may be very simple but it is being difficult for me. I have two vectors with some common string. And, i want to combine into a vector in such a way that it includes string from both vectors and make a unique. For example: x-

Re: [R] what is this averaging function called ?, has R a built in function for it ?

2010-12-05 Thread Tal Galili
Hi there, I didn't fully follow your code, but allow me to ask: *What is your input - and what do you want to output to be?* Is you input a vector (array) of points? Is your output some sort of averaging of the points according to order? If you searching for a function to smooth a sequance of

Re: [R] merging two vectors

2010-12-05 Thread Santosh Srinivas
unique(c(x,y)) On Sun, Dec 5, 2010 at 8:27 PM, ram basnet basnet...@yahoo.com wrote: Dear R users, It may be very simple but it is being difficult for me. I have two vectors with some common string. And, i want to combine into a vector in such a way that it includes string from both vectors

Re: [R] Problem storing lm() model in a list

2010-12-05 Thread Tal Galili
Hi Harold, I think the error stems from the data.frame you are entering into the predict function. Your data.frame must have the EXACT column name as the one used for the creation of the model object. Is that the case in your code? Best, Tal Contact

Re: [R] merging two vectors

2010-12-05 Thread David Winsemius
On Dec 5, 2010, at 9:57 AM, ram basnet wrote: Dear R users, It may be very simple but it is being difficult for me. I have two vectors with some common string. And, i want to combine into a vector in such a way that it includes string from both vectors and make a unique. For example: x

[R] HOW to use the survivalROC to get optimal cut-off values?

2010-12-05 Thread petretta
I have the same problem of a prevous request HOW to use the survivalROC (or another library in R) to get optimal cut-off values? I want to use the time-dependent survivalROC package.according to the,reference material,it only gives a set of ordered cut-off values .eg.

Re: [R] HOW to use the survivalROC to get optimal cut-off values?

2010-12-05 Thread David Winsemius
On Dec 5, 2010, at 11:14 AM, petre...@unina.it wrote: I have the same problem of a prevous request HOW to use the survivalROC (or another library in R) to get optimal cut-off values? I want to use the time-dependent survivalROC package.according to the,reference material,it only gives a

[R] Converting numbers into words

2010-12-05 Thread Thomas Levine
Example data desk=data.frame( deskchoice=c('mid','mid','left','bookdrop','mid','bookdrop') ) -- I like doing stuff like the line below, especially when I'm using Sweave. print(paste('Within the observation period,',nrow(desk), 'patrons approached the circulation desk.')) -- But what if I

Re: [R] Converting numbers into words

2010-12-05 Thread Gabor Grothendieck
On Sun, Dec 5, 2010 at 11:50 AM, Thomas Levine thomas.lev...@gmail.com wrote: Example data desk=data.frame( deskchoice=c('mid','mid','left','bookdrop','mid','bookdrop') ) -- I like doing stuff like the line below, especially when I'm using Sweave. print(paste('Within the observation

[R] HOW to use str() after the survivalROC (or another library in R) to get optimal cut-off values

2010-12-05 Thread petretta
I have the same problem of a previous request HOW to use the survivalROC (or another library in R) to get optimal cut-off values? I want to use the time-dependent survivalROC package.according to the,reference material,it only gives a partial set of ordered cut-off values .eg.

Re: [R] HOW to use str() after the survivalROC (or another library in R) to get optimal cut-off values

2010-12-05 Thread Joshua Wiley
Hi Mario, On Sun, Dec 5, 2010 at 10:11 AM, petre...@unina.it wrote: I have the same problem of a previous request HOW to use the survivalROC (or another library in R) to get optimal cut-off values? I want to use the time-dependent survivalROC package.according to the,reference

Re: [R] Checking for orthogonal contrasts

2010-12-05 Thread peter dalgaard
On Dec 3, 2010, at 17:17 , S Ellison wrote: David, Thanks for the comments. I think, though, that I have found the answer to my own post. Question: How would one check, in R, that [contrasts .. are 'orthogonal in the row-basis of the model matrix'] for a particular fitted linear

Re: [R] The behaviour of read.csv().

2010-12-05 Thread Rolf Turner
On 6/12/2010, at 3:00 AM, Duncan Murdoch wrote: I was going to suggest using DIF rather than CSV. It contains more internal information about the file (including the type of each entry), but has the disadvantage of being less readable, even though it is ascii. I don't think DIF is

Re: [R] The behaviour of read.csv().

2010-12-05 Thread David Winsemius
On Dec 5, 2010, at 2:14 PM, Rolf Turner wrote: On 6/12/2010, at 3:00 AM, Duncan Murdoch wrote: As of r53778, the bugs I noticed should be fixed. read.DIF now respects the internal type information, so it will keep character strings like 001 as type character (unless you ask it to change

Re: [R] Problem storing lm() model in a list

2010-12-05 Thread William Dunlap
Your problem arises because predict() is using the value d=10 whenever it evaluates poly(x,d,raw=TRUE). The details are that this is the value that d in your function polyModelSelection had when the function finished. That value is stored in the environment

Re: [R] HOW to use the survivalROC to get optimal cut-off values?

2010-12-05 Thread David Winsemius
On Dec 5, 2010, at 11:33 AM, David Winsemius wrote: On Dec 5, 2010, at 11:14 AM, petre...@unina.it wrote: I have the same problem of a prevous request HOW to use the survivalROC (or another library in R) to get optimal cut-off values? I want to use the time-dependent survivalROC

Re: [R] Problem storing lm() model in a list

2010-12-05 Thread Harold Pimentel
Hi Tal, That is correct. In the code, I actually call the same exact data.frame that was used to create the object. I understand I can call predict() without a data.frame to get this result, but I would like to predict other datasets as well. Thanks, Harold On Dec 5, 2010, at 7:18 AM, Tal

[R] less than or equal to glyph

2010-12-05 Thread romzero
If i insert \u2264 inside the text, like this lsd_label - LSD (P \u2264 0.05) = the result is LSD (P = 0.05) = instead LSD (P ≤ 0.05) = how can i solve this problem? Thanks. -- View this message in context:

[R] How to catch both warnings and errors?

2010-12-05 Thread Marius Hofert
Dear expeRts, I am struggling with warning/error handling. I would like to call a function which can produce either a) normal output b) a warning c) an error Since the function is called several (thousand) times in a loop, I would like to proceed quietly and collect the warnings and errors

[R] lm() and interactions in model formula for x passed as matrix

2010-12-05 Thread William Simpson
Suppose I have x variables x1, x2, x3 (however in general I don't know how many x variables there are). I can do X-cbind(x1,x2,x3) lm(y ~ X) This fits the no-interaction model with b0, b1, b2, b3. How can I get lm() to fit the model that includes interactions when I pass X to lm()? For my

Re: [R] less than or equal to glyph

2010-12-05 Thread Joshua Wiley
Hi, I suspect this has to do with your locale, as it seems to work on my system. Take a look at: Sys.getlocale() # see yours ?Sys.setlocale # documentation If you're are talking about something to add to a graph (e.g., in the title or labelling a point) try: sd_label - substitute(LSD~(P =

Re: [R] lm() and interactions in model formula for x passed as matrix

2010-12-05 Thread David Winsemius
On Dec 5, 2010, at 3:19 PM, William Simpson wrote: Suppose I have x variables x1, x2, x3 (however in general I don't know how many x variables there are). I can do X-cbind(x1,x2,x3) lm(y ~ X) This fits the no-interaction model with b0, b1, b2, b3. How can I get lm() to fit the model that

Re: [R] lm() and interactions in model formula for x passed as matrix

2010-12-05 Thread Joshua Wiley
Hi Bill, If you can put all (and only) your variables into a dataframe, (for example: X - data.frame(y, x1, x2, x3) ) then another alternative to David's solution would be: lm(y ~ .^3, data = X) '.' will expand to every column except y, and then the ^3 will get you up to 3-way interactions.

Re: [R] The behaviour of read.csv().

2010-12-05 Thread Duncan Murdoch
On 05/12/2010 2:14 PM, Rolf Turner wrote: On 6/12/2010, at 3:00 AM, Duncan Murdoch wrote: I was going to suggest using DIF rather than CSV. It contains more internal information about the file (including the type of each entry), but has the disadvantage of being less readable, even though

Re: [R] lm() and interactions in model formula for x passed as matrix

2010-12-05 Thread William Simpson
Thanks for the replies. I was just thinking that, for a two variable example, doing X-cbind(x1,x2,x1*x2) lm(y~X) would work. So maybe that's what I'll do. This also allows me to pick and choose which interactions to include. Cheers Bill On Sun, Dec 5, 2010 at 8:19 PM, William Simpson

Re: [R] Error in calcCurveGrob(x, x$debug) : End points must not be identical

2010-12-05 Thread Bryan Hanson
Thanks Paul... I wasn't sure in what way the end points were identical and was testing differently, and failing to catch it. I'll have to check my computations now to see why I'm getting curves that meet this condition, as I don't think I should be. But I'm back on track now. The problem with

Re: [R] How to catch both warnings and errors?

2010-12-05 Thread David Winsemius
On Dec 5, 2010, at 3:13 PM, Marius Hofert wrote: Dear expeRts, I am struggling with warning/error handling. I would like to call a function which can produce either a) normal output b) a warning c) an error Since the function is called several (thousand) times in a loop, I would like to

Re: [R] How to catch both warnings and errors?

2010-12-05 Thread Marius Hofert
On 2010-12-06, at 01:07 , David Winsemius wrote: On Dec 5, 2010, at 3:13 PM, Marius Hofert wrote: Dear expeRts, I am struggling with warning/error handling. I would like to call a function which can produce either a) normal output b) a warning c) an error Since the function is

Re: [R] Hmisc label function applied to data frame

2010-12-05 Thread Krishna Tateneni
Hello again, I have found that if I use sapply, I do not get a warning, i.e., lbl1 = sapply(d[,var1],label) works correctly and gives no warning. I'm sorry this did not occur to me earlier, my apologies! --Krishna On Thu, Dec 2, 2010 at 11:36 AM, Krishna Tateneni taten...@gmail.comwrote:

[R] How to get lasso fit coefficient(given penalty tuning parameter \lambda) using lars package

2010-12-05 Thread michael
Hi, all, I am using the lars package for lasso estimate. So I get a lasso fit first: lassofit = lars(x,y,type =lasso,normalize=T, intercept=T) Then I want to get coefficient with respect to a certain value of \lambda (the tuning parameter), I know lars has three mode options c(step,

Re: [R] How to get lasso fit coefficient(given penalty tuning parameter \lambda) using lars package

2010-12-05 Thread michael
Oh, I just realize that I can actually just use this: beta = coef(lassofit, s=5, mode=lambda) Michael On Sun, Dec 5, 2010 at 8:10 PM, michael tufemich...@gmail.com wrote: Hi, all, I am using the lars package for lasso estimate. So I get a lasso fit first: lassofit =

Re: [R] How to catch both warnings and errors?

2010-12-05 Thread David Winsemius
On Dec 5, 2010, at 7:35 PM, Marius Hofert wrote: On 2010-12-06, at 01:07 , David Winsemius wrote: On Dec 5, 2010, at 3:13 PM, Marius Hofert wrote: Dear expeRts, I am struggling with warning/error handling. I would like to call a function which can produce either a) normal output b) a

[R] Runif Help: same variable, 3 different parameters

2010-12-05 Thread pythonomics
So I am working on an economic model and I need to change the parameters of the runif statement as time goes on. Ex. X -runif(1:50,0,5) X -runif(51:100,100,150) X -runif(100:T, 1,2) Not sure how to go about entering this in to R properly. -- View this message in context:

[R] Runif Help: same variable, 3 different parameters

2010-12-05 Thread pythonomics
So I am working on an economic model and I need to change the parameters of the runif statement as time goes on. Ex. X -runif(1:50,0,5) X -runif(51:100,100,150) X -runif(100:T, 1,2) Not sure how to go about entering this in to R properly. -- View this message in context:

[R] How to this SAS transport file in R?

2010-12-05 Thread zhiji19
Dear All, I try to read the SAS transport file in R, but it shows error. Please help! I am using R 2.11.1 library(foreign) download.file(http://isites.harvard.edu/fs/docs/icb.topic35387.files/demo_c.xpt,C:/Desktop/demo_c.xpt;) sasxport - read.xport(C:/Desktop/demo_c.xpt) Error in

Re: [R] How to this SAS transport file in R?

2010-12-05 Thread Prof Brian Ripley
You didn't tell us your OS. That is a binary file, and from ?download.file: mode: character. The mode with which to write the file. Useful values are ‘w’, ‘wb’ (binary), ‘a’ (append) and ‘ab’. Only used for the ‘internal’ method. Only on Windows are the binary modes

Re: [R] How to this SAS transport file in R?

2010-12-05 Thread David Freedman
I've had good success with the read.xport function in the SASxport (not foreign) package. But couldn't you just use something like mydata-read.xport('http/demo_c.xpt') The transport file looks like it's one of the NHANES demographic files. -- View this message in context:

Re: [R] How to this SAS transport file in R?

2010-12-05 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of zhiji19 Sent: Sunday, December 05, 2010 9:26 PM To: r-help@r-project.org Subject: [R] How to this SAS transport file in R? Dear All, I try to read the SAS transport file

[R] Can't read data coded in Cyrillic

2010-12-05 Thread Dan Winetsky
To whom it may concern, I have a database (an SPSS .sav file) with some vectors containing strings of words in Cyrillic. My console, however, doesn't seem to read Cyrillics. If I type Привет into the console it shows Ïðèâåò as I'm typing. Please note that courier new, my console's

Re: [R] Error in calcCurveGrob(x, x$debug) : End points must not be identical

2010-12-05 Thread Paul Murrell
Hi Bryan Hanson wrote: Hi All... I haven¹t found mention of this error anywhere. I'm trying to draw spline curves using grid graphics. Most of the time, I have no problems, but I have some data sets that give the error in the subject line. I'm not sure which end points are identical, but the

Re: [R] Runif Help: same variable, 3 different parameters

2010-12-05 Thread Dieter Menne
pythonomics wrote: So I am working on an economic model and I need to change the parameters of the runif statement as time goes on. X -runif(1:50,0,5) X -runif(51:100,100,150) X -runif(100:T, 1,2) T=1000 c(runif(1:50,0,5), runif(51:100,100,150),runif(100:T, 1,2)) Dieter -- View

Re: [R] Runif Help: same variable, 3 different parameters

2010-12-05 Thread pythonomics
Cheers Dieter. You are a true bro. -- View this message in context: http://r.789695.n4.nabble.com/Runif-Help-same-variable-3-different-parameters-tp3073894p3074041.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org