Re: [R] need help with withRestarts ?

2014-12-06 Thread ce
Thank you very much Martin and Chel Hee. Indeed both approach works but Martin's approach covers whole function while Chel Hee's concentrates on problem line. Also another thanks to Martin for lesson on error handling which I desperately need. ce -Original Message- From: "Chel He

Re: [R] Scatter plot for repeated measures

2014-12-06 Thread Chel Hee Lee
It seems that you would like to make a spaghetti plot (in a longitudinal data analysis). You can use the function 'interaction.plot()'. > with(my.df, interaction.plot(TIME, ID, X)) I hope this helps. Chel Hee Lee On 12/06/2014 02:24 AM, arun wrote: Not sure whether it is a scatterplot or

Re: [R] need help with withRestarts ?

2014-12-06 Thread Chel Hee Lee
I am very happy to see the message replied by Martin Morgan. He provides an example how to use the function 'withRestarts()'. I personally like his approach; however, the function 'tryCatch()' evaluates the first argument 'expression'. That's, this function can be placed on anywhere. It see

Re: [R] bad STATA dataset import, how to change value labels

2014-12-06 Thread Edoardo Prestianni
Excuse the inaccuracy, the warning is "value label missing". the same variable is considered as factor (w/ values ranging from a to b) in one dataset, as int in another. I want it to be a factor in both. I think I am missing a package, the output is. Error in head(dfrm[, "variable"]) : object 'df

Re: [R] bad STATA dataset import, how to change value labels

2014-12-06 Thread David Winsemius
On Dec 6, 2014, at 3:54 PM, Edoardo Prestianni wrote: > hello, > > I have imported a couple of .dta datasets, but a variable, instead of being > labeled as factor (w/ values ranging from a to b) is labeled as integer. > > How can I fix this? I am sorry if it is a rookie question but I don't fin

Re: [R] need help with withRestarts ?

2014-12-06 Thread Martin Morgan
On 12/06/2014 02:53 PM, ce wrote: Dear all, Let's say I have this script , below. tryCatch indeed catches the error but exists, I want function to continue and stay in the loop. I found very examples of withRestarts on internet to figure it out. Could you help me how to do it ? myfunc <-

[R] bad STATA dataset import, how to change value labels

2014-12-06 Thread Edoardo Prestianni
hello, I have imported a couple of .dta datasets, but a variable, instead of being labeled as factor (w/ values ranging from a to b) is labeled as integer. How can I fix this? I am sorry if it is a rookie question but I don't find the command googling. Thanks everyone for their help, -- Edoard

[R] need help with withRestarts ?

2014-12-06 Thread ce
Dear all, Let's say I have this script , below. tryCatch indeed catches the error but exists, I want function to continue and stay in the loop. I found very examples of withRestarts on internet to figure it out. Could you help me how to do it ? myfunc <- function() { while(1) { x <- r

[R] vectorization of rolling function

2014-12-06 Thread A Duranel
Hello I use R to run a simple model of rainfall interception by vegetation: rainfall falls on vegetation, some is retained by the vegetation (part of which can evaporate), the rest falls on the ground (quite crude but very similar to those used in SWAT or MikeSHE, for the hydrologists among you). I

Re: [R] backslash quirk in paste

2014-12-06 Thread William Dunlap
"\\" is stored as a single backslash, just as "\n" is a single newline character. It is printed with an extra backslash. > nchar("\\") [1] 1 > cat(paste0("\\", "\n")) \ Bill Dunlap TIBCO Software wdunlap tibco.com On Sat, Dec 6, 2014 at 11:00 AM, Prof J C Nash (U30A) wrote: > This i

Re: [R] backslash quirk in paste

2014-12-06 Thread Jeff Newmiller
fname = "John"; lname = "Smith" ans <- paste( fname, " \\ ", lname ) cat( ans) print( ans ) Note that ans only has one backslash in it, but print gives you a source-suitable string with the escape character. --- Jeff Newmill

Re: [R] backslash quirk in paste

2014-12-06 Thread Prof J C Nash (U30A)
Thanks. Now why didn't I think of that? However, it underlines that there is an implicit call to print(), which processes the string rather than simply dumping it to the screen. That's something to remember (and I should have!). Best, JN On 14-12-06 02:30 PM, Ben Tupper wrote: > Hi, > > When yo

Re: [R] backslash quirk in paste

2014-12-06 Thread Ben Tupper
Hi, When you call paste without assigning the value it returns to anything it runs through the print command. So, while your string may contain escapes, using print will not present escapes as you are expecting them. In this case you could wrap cat() around your paste command. > cat(paste(

[R] backslash quirk in paste

2014-12-06 Thread Prof J C Nash (U30A)
This is NOT critical. It arose due to a fumble fingers when developing an R example, but slightly intriguing. How could one build a string from substrings with a single backslash (\) as separator. Here's the reproducible example: fname = "John"; lname = "Smith" paste(fname, lname) paste(fname, ln

[R] (no subject)

2014-12-06 Thread solmaz taheri
dear I am interested about"A semiparametric recurrent events model with time-varying coefficients*"* > I want to analyze my data with related R program but i could not get it from its correspondence. the similar program in frailtypack exict but only used Gamma or Lognormal frailty whereas in th

Re: [R] Scatter plot for repeated measures

2014-12-06 Thread arun
Not sure whether it is a scatterplot or just a plot with 3 lines. If it is the latter, library(reshape2) matplot(acast(my.df, TIME~ID, value.var='X'), type='l', col=1:3, ylab='X', xlab='TIME') legend('bottomright', inset=.05, legend=LETTERS[1:3], pch=1, col=1:3) A.K. On Friday, December 5,

Re: [R] Difference in cummulative variance depending on print command

2014-12-06 Thread peter dalgaard
Firstly, there is no fa() function in base R. There is one in package psych(), which has a maintainer, etc. I guess that it is because fa() does a non-orthogonal factor rotation and its print method knows about it, whereas the default print method for loadings assumes that rotations are orthogo

Re: [R] How to build a vignette?

2014-12-06 Thread PO SU
OK, I got it , you helped me  a lot , tks very much. :) -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU At 2014-12-06 14:12:45, "Jeff Newmiller" wrote: >If you run R CMD check on your package successfully, then that file will be >generated as needed automatically. If

Re: [R] How to build a vignette?

2014-12-06 Thread PO SU
Yeah, i can write some roxygen2 which transformed to .RD files.  The pdf of a  package in the cran is not a vignette?  That's to say some packages have not vignettes?  And the pdf version is generated by me or cran ? If by me , how can i generate it from my .RD files. i am writing  a package, s