[R] Package Hmisc, functions summary.formula() and latex(), options pdig, pctdig, eps and prmsd

2008-07-25 Thread David Hajage
Hello R users, I have several problems with the functions summary.formula and latex in package Hmisc. Here an example : library(Hmisc) sex <- factor(sample(c("m","f", "?"), 50, rep=TRUE)) age <- rnorm(50, 50, 5) treatment <- factor(sample(c("Drug","Placebo"), 50, rep=TRUE)) symp <- c('Headac

Re: [R] Package Hmisc, functions summary.formula() and latex(), options pdig, pctdig, eps and prmsd

2008-07-25 Thread David Hajage
2008/7/25 Frank E Harrell Jr <[EMAIL PROTECTED]> > David Hajage wrote: > >> Hello R users, >> >> I have several problems with the functions summary.formula and latex in >> package Hmisc. Here an example : >> >> >> library(Hmisc) >>

Re: [R] Package Hmisc, functions summary.formula() and latex(), options pdig, pctdig, eps and prmsd

2008-07-26 Thread David Hajage
Oh... No, I don't need to read the documentation again. I just need to wake up... 2008/7/25 Frank E Harrell Jr <[EMAIL PROTECTED]> > David Hajage wrote: > >> >> >> 2008/7/25 Frank E Harrell Jr <[EMAIL PROTECTED] > [EMAIL PROTECTED]>> >> &g

Re: [R] speeding up loop and dealing wtih memory problems

2008-07-28 Thread David Hajage
Is it what you want ? > x <- matrix(c(1:3, NA, NA, 4, 1:2, NA), 3, 3) > x [,1] [,2] [,3] [1,]1 NA1 [2,]2 NA2 [3,]34 NA > x[is.na(x)] <- 0 > x [,1] [,2] [,3] [1,]101 [2,]202 [3,]340 2008/7/28 Denise Xifara <[EMAIL PROTECT

[R] is this a bug (apply and class) ?

2008-08-01 Thread David Hajage
Hello R users, I run this code under windows XP and R 2.7.1 : > head(esoph) agegp alcgptobgp ncases ncontrols 1 25-34 0-39g/day 0-9g/day 040 2 25-34 0-39g/day10-19 010 3 25-34 0-39g/day20-29 0 6 4 25-34 0-39g/day 30+ 0 5 5

Re: [R] Newbie question: How to use tapply() on several vectors simultaneously

2008-08-01 Thread David Hajage
something like that should work : aggregate(test, list(test[,1]), mean) 2008/8/1 Bertolt Meyer <[EMAIL PROTECTED]> > Dear R users, > > I have a newbie-question that I couldn't resolve after reading through > several pieces of documentation and searching the archive. > > I have a data.frame cont

Re: [R] sampling

2008-08-11 Thread David Hajage
I'm not sure I understand, but is this what you want ? quant <- seq(0,1,0.05) perc<-c(1:234/234) rows <- sapply(quant, function(x){which.min(abs(x - perc))}) perc[rows] 2008/8/11 Duncan Murdoch <[EMAIL PROTECTED]> > Gareth Campbell wrote: > >> Hello, >> I have a matrix and I want to sample 20

Re: [R] Between the values

2008-08-12 Thread David Hajage
But is there a way to construct a S4 method with this syntax : 0 < C < 1 ? Apparently, it's not possible with S4 group generics "Compare(e1, e2)". 2008/8/12 Ravi Varadhan <[EMAIL PROTECTED]> > Here is how you check whether a < x < b "without" using the `&' condition: > > is.between <- function(

Re: [R] produce variable on the fly

2008-08-12 Thread David Hajage
> vect = c(10:20) > for (i in 1:10) { + assign(paste("VAR",i,sep=""), vect[i]) + } > VAR1 [1] 10 > VAR2 [1] 11 2008/8/12 jimineep <[EMAIL PROTECTED]> > > Hi guys, > > I want to create variable on the fly: for example > > for (i in 1:10) { >cat(paste("VAR",i,sep="")) > } > Will print VAR1,

Re: [R] Using lme, how to specify: (1) repeated measures, and (2) Toeplitz covariance structure?

2008-08-23 Thread David Hajage
1) I think that the repeated measure is not "years", but, as you said, the "count of birds". If you are interested with the effect of the time variable (years), perhaps you need to introduce it as a fixed effect ? 2) See ?corARMA. 2008/8/22 mtb954 <[EMAIL PROTECTED]> > We are attempting to use n

Re: [R] drop unused levels in sqldf

2008-08-28 Thread David Hajage
If you want to suppress the unused level of Species, you can use factor() : table(base$Species) table(factor(base$Species)) 2008/8/28 glaporta <[EMAIL PROTECTED]> > > Hi, > sqldf is a fantastic package, but when the SELECT procedure runs unused > levels remain in the output. I tried with the dro

Re: [R] How to create functions with new "defaults"?

2008-09-02 Thread David Hajage
I can't test it right now, but is this ok ? t.test.new <- function(x, y = NULL, alternative = c("two.sided", "less", "greater"), mu = 0, paired = TRUE, var.equal = FALSE, conf.level = 0.95, ...) { t.test(x, y, alternative, mu, paired, var.equal, conf.lev

Re: [R] tranform a table?

2009-09-10 Thread David Hajage
I think you could use reshape and ascii package here. Create a file ("code.Rnw") with this code : John and Jane = <<>>= df <- data.frame(names = c("John", "Jane"), field1 = c("value1", "value2"), field2 = c("value3", "value4")) library(reshape) cdf <- cast(melt(df, id = "names"), var

Re: [R] comma as decimal separator in xtable

2009-09-16 Thread David Hajage
Perhaps with the dcolumn package ? http://newton.ex.ac.uk/research/qsystems/people/latham/LaTeX/dcolumn.pdf David 2009/9/16 Jakson A. Aquino > On Wed, Sep 16, 2009 at 07:11:46AM +0200, Schalk Heunis wrote: > > This might be of help, first applies the > formatting:print(xtable(prettyNum(d, > > d

Re: [R] comma as decimal separator in xtable

2009-09-16 Thread David Hajage
(x, align = c("l", "|", "d{2}", "|", "c", "|")) @ \end{document} 2009/9/16 Jakson A. Aquino > On Wed, Sep 16, 2009 at 01:59:29PM +0200, David Hajage wrote: > > Perhaps with the dcolumn package ? > > http://newton.ex.ac.uk/

Re: [R] latex code in R -> convert to pdf

2009-09-17 Thread David Hajage
Hello, You could try : - odfWeave : to generate odf (open office...) report - R2HTML and hwriter : to generate html report - ascii : to generate asciidoc report and then convert it to html, xml, pdf and more. 2009/9/17 Philipp Pagel > On Thu, Sep 17, 2009

[R] Random center effect

2010-02-16 Thread David Hajage
Hello R users, I'm trying to take into acount the center effect in a clinical study comparing 3 treatments (data from the book Applied Mixed Models in Medicine Statistics by Helen Brown and Robin Prescott): - dbp: diastolic blood pressure at 8 weeks - dbp0: diastolic blood pressure at inclusion -

[R] ggplot2 : bug in coord_equal() ?

2010-02-26 Thread David Hajage
Hello, I think there is a bug in coord_equal when x s a factor : ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar() ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar() + coord_equal(1/2) David __ R-help@r-project.org mailing list https://stat.eth

Re: [R] storing output in html or pdf table format.

2009-07-28 Thread David Hajage
Or you can have a look to ascii package (examples here or here ). david 2009/7/28 ONKELINX, Thierry > > Have a look at Sweave (in the utils package) or the R2HTML package. > > HTH, > > Thierry > > > -

Re: [R] sweave and R. Searching for a document that will get me started

2009-08-07 Thread David Hajage
Sweave/LaTeX is the most powerfull tool to write document with embedded R code. The hard task is to learn LaTeX. But you could also have a look to packages: - R2HTML or hwriter if you prefer HTML markup, - odfWeave if you prefer write document with OpenOffice for example, - or ascii, if you wan

Re: [R] What is the best way to have "R" output tables in an MS Word format?

2010-05-01 Thread David Hajage
Another option is to use ascii package . Just choose your favorite markup language (asciidoc, txt2tags , restructuredtext, org-mode

Re: [R] AsciiDoc and R

2009-09-30 Thread David Hajage
Hello, There is a webpage showing examples of asciidoc and R here : http://eusebe.github.com/ascii/ The package works with Sweave() function : Sweave("yourfile.Rnw", driver = RweaveAsciidoc) where "youfile.Rnw" is a text file with asciidoc markup and embedded R code. About asciidoc markup, the d

[R] [R-pkgs] ascii package updated

2009-10-30 Thread David Hajage
mprove col alignment in txt2tags output - improve row and col span (cgroup and rgroup) - remove SweaveAscii() function - new Asciidoc(), T2t(), Sphinx() and Org() functions (wrapper for Sweave("file.Rnw", RweaveXxx)) Best, David Hajage [[alternative

Re: [R] How to: highlight R syntax on webpages ?

2009-11-21 Thread David Hajage
Hello, ascii package provides a alternative to org-babel/R. it allows to use Sweave with org files (many thanks to Erik and his blog for this...). http://eusebe.github.com/ascii/#_other_outputs http://eusebe.github.com/ascii/org.html#undefined david 2009/11/20 Thomas S. Dye > Hi Erik, > > Inte

Re: [R] Using package "exams" and xtable

2009-05-27 Thread David Hajage
Hello, \Sexpr only displays one value. Why don't you print your vector into a verbatim environment ? <> print(rx) @ But if you want to generate a table with xtable, one solution : <> print(xtable(as.data.frame(t(rx))), include.rownames = F, include.colnames = F) @ David On Tue, May 26, 200

Re: [R] SAS-like method of recoding variables?

2009-06-23 Thread David Hajage
You can also use if (cond) then {something} if you don't like ifelse() function. See ?Control. David 2009/6/23 Peter Flom > >Dieter Menne wrote: > >> > IF TYPE='TRUCK' and count=12 THEN VEHICLES=TRUCK+((CAR+BIKE)/2.2); > >>> vehicles <- ifelse(TYPE=='TRUCK' & count=12, TRUCK+((CAR+BIKE)/2.

[R] [R-pkgs] New package: ascii version 0.1

2009-04-06 Thread David Hajage
Hi, ascii is a new R package for writing asciidoc or txt2tags document with embeded R commands. It provides: - a generic method for common R objects: ascii(). Default argument depends of R object. - two Sweave drivers: Sweave("yourfile.Rnw", RweaveAsciidoc) or Sweave("yourfile.Rnw", RweaveT2t).

Re: [R] performing function on data frame

2009-04-15 Thread David Hajage
Hi Karin, I'm not sure I understand... Is this what you want ? d$y - mean(d$y)/sd(d$y) 2009/4/15 Karin Lagesen > > Hi! > > First, pardon me if this is a faq. I think I should be using some sort > of apply, but I am not managing to figure those out. > > I have a data frame similar to this: > >

[R] cast function in package reshape

2009-04-17 Thread David Hajage
Hello R useRs, I have a function which returns a list of functions : freq1 <- function(x) { lev <- unique(x[!is.na(x)]) nlev <- length(lev) args <- alist(x=) if (nlev == 1) { body <- c("{", "sum(!is.na(x))", "}") f <- function() {} formals(f) <- as.pairlist(args) body(f)

Re: [R] Presenting R Results in Webpages

2009-04-17 Thread David Hajage
You could perhaps use asciidoc and ascii package (but I'm not sure you could obtain exactly the layout you describe...). 2009/4/17 Jim Lemon > Jason Rupert wrote: > >> I apologize in advance that this question is not specific t

Re: [R] Presenting R Results in Webpages

2009-04-17 Thread David Hajage
and also R2HTML. 2009/4/17 David Hajage > You could perhaps use asciidoc <http://www.methods.co.nz/asciidoc/>and ascii > <http://eusebe.github.com/ascii/>package (but I'm not sure you could > obtain exactly the layout you describe...). > > 2009/4/17 Jim Lemon

Re: [R] plot confidence intervals as shaded band

2009-04-23 Thread David Hajage
Perhaps you'll be interested in denstrip package : http://cran.r-project.org/web/packages/denstrip/index.html Examples : http://www.mrc-bsu.cam.ac.uk/personal/chris/papers/denstrip.pdf 2009/4/22 BARRES-DE-ALMEIDA U. > Hi, > > does anyone know how do I plot confidence intervals as a shaded band

[R] rbind on a list

2009-04-23 Thread David Hajage
I have two lists (and possibly more): col.prop <- structure(list(B = structure(c(0.5, 0.5, 0.6, 0.4, 0.556, 0.444), class = c("cast_matrix", "matrix"), .Dim = 2:3, .Dimnames = list( NULL, NULL)), D = structure(c(1, 0, 0.667, 0.333, 0.8, 0.2), cla

Re: [R] rbind on a list

2009-04-23 Thread David Hajage
Thank you, it is working. David 2009/4/23 Henrique Dallazuanna > Try this: > > lapply(names(col.prop), function(idx)rbind(col.prop[[idx]], n[[idx]])) > > On Thu, Apr 23, 2009 at 7:33 AM, David Hajage wrote: > >> I have two lists (and possibly more): >> >

Re: [R] RweaveHTML (R2HTML) Help

2009-04-29 Thread David Hajage
Hello Derek, Unfortunately, I can't help you with R2HTML. But if you want to generate html output of R commands, you could also try ascii package (available on CRAN). Here an example file ("example.Rnw", with asciidoc markup) :

Re: [R] Calculating Summaries for each level of a Categorical variable

2010-06-27 Thread David Hajage
You could try the remix function in remix package. David Le 27 juin 2010 à 06:48, RaoulD a écrit : > > Hi Christos, > > Thanks for this. I had a look at Summary.Forumla in the Hmisc > package and it > is extremely complicated for me. Still trying to decipher how I > could use > it. > > Regards,

Re: [R] Reproducible research

2010-09-09 Thread David Hajage
Hello David, You could also have a look to the ascii package : http://eusebe.github.com/ascii/ With asciidoc (http://www.methods.co.nz/asciidoc/), or one of other markup languages supported (restructuredtext, txt2tags, or textile), you can obtain good results. For example, vignettes of the book "A

Re: [R] LaTeX, MiKTeX, LyX: A Guide for the Perplexed

2010-12-08 Thread David Hajage
Hello, You could also be interested by the ascii package, which allows to use Sweave with more simple markup languages such as asciidoc, txt2tages or restructuredtext. An asciidoc based Rnw file is in my opinion more readable and sharable than a latex based. Best. On Wednesday, December 8, 2010

Re: [R] LaTeX, MiKTeX, LyX: A Guide for the Perplexed

2010-12-08 Thread David Hajage
Two more cents: pandoc support is in my todo list... But I don't have the time actually. On Wednesday, December 8, 2010, Patrick Hausmann wrote: > Hi Paul, > I am using Sweave and MiKTeX and the results are really impressive, but it's > often quite complicated (or impossible) to share the rnw-fi

Re: [R] descriptive statistics

2010-12-13 Thread David Hajage
Another way is the remix function of the remix package. On Monday, December 13, 2010, justin bem wrote: > A nice way to obtain summary for data is to use summary.formula in Hmisc > package. > >  Justin BEM > BP 1917 Yaoundé > Tél (237) 76043774 > > > > > > De : Ji

[R] mtext coordinates

2010-08-18 Thread David Hajage
Hello, I am using mtext to write some text below a graph: plot(1) mtext("foo", side = 1, line = 2, at = seq(0.6, 1.6, 0.2)) I would like to draw something near the "foo" texts, for example a segment. For this, I need to know the coordinates of the text ploted by mtext function. I spent a few ho

Re: [R] mtext coordinates

2010-08-18 Thread David Hajage
/18/2010 08:40 PM, David Hajage wrote: > >> Hello, >> >> I am using mtext to write some text below a graph: >> >> plot(1) >> mtext("foo", side = 1, line = 2, at = seq(0.6, 1.6, 0.2)) >> >> I would like to draw something near the &

Re: [R] R reports

2010-08-19 Thread David Hajage
and: - brew - HTMLUtils - ascii - odfWeave - R2HTML - hwriter - ... 2010/8/19 ONKELINX, Thierry > Dear Donald, > > I'm not sure what the meaning of '3G' and '4G' is. You should take a > look at Sweave() which is a very powerfull tool for generating reports > in R. > > HTH, > > Thierry > >

Re: [R] R reports

2010-08-19 Thread David Hajage
I'm not sure I understand what is 3GL or 4GL, but R is on the list of "fourth-generation languages : Data manipulation, analysis, and reporting languages" on wikipedia. I don't know a function lik

Re: [R] Latex no where to be seen

2010-08-20 Thread David Hajage
"It amazes me that there's not a built in "report" function that can produce the same kinds of reports that every report writer and data analysis software in the whole word can do. (see SAS, Crystal Reports, SPSS, Oracle Reports, Actuate, Hyperion, Cognos, ..etc)" To do some reports, most of R use

Re: [R] R reports

2010-08-21 Thread David Hajage
Just show us what is the kind of report you want to do, and you will perhaps get a solution to reproduce it. Then, if you don't like the way to do that, write your own code or don't use R, noone force you. The majority of R users are satisfied with the way to generate reports, because it is flexibl

Re: [R] R reports

2010-08-21 Thread David Hajage
e R > community, where learning is highly valued, may be fundamentally incompatible > with your philosophy.  You may do well to stay with SAS. > > Frank > > > > > > > From: David Hajage-2 [via R] > > Sent: Sat, August 21

Re: [R] R reports

2010-08-22 Thread David Hajage
p to do that. > I've read "R IN A NUTSHELL" from cover to cover. The word "report" does not > even appear in the index. > Just ask Joseph Adler. > > On Aug 21, 2010, at 11:39 AM, David Hajage wrote: > > > I must repeat: "just show us what

[R] print method for str?

2010-08-26 Thread David Hajage
Hello useRs and guRus, I was trying to add the support of str() in the ascii package, and I realized that str() does not have a print method. It uses cat() from inside the function and returns nothing. Since it is not usual in R, I wonder why? Is there a particular reason? Thank you very much fo

Re: [R] print method for str?

2010-08-26 Thread David Hajage
Exact, "efficiency", I didn't see that. Thank you very much. 2010/8/26 Gavin Simpson : > On Thu, 2010-08-26 at 10:42 +0200, David Hajage wrote: >> Hello useRs and guRus, >> >> I was trying to add the support of str() in the ascii package, and I >> realiz

Re: [R] Adding dash-lines in R tables

2011-05-22 Thread David Hajage
moreover: > library(ascii) > M <- matrix(letters[1:10], 2) > M [,1] [,2] [,3] [,4] [,5] [1,] "a" "c" "e" "g" "i" [2,] "b" "d" "f" "h" "j" > ascii(M) | | a | c | e | g | i | b | d | f | h | j | > print(ascii(M), "rest") +---+---+---+---+---+ | a |

[R] [R-pkgs] ascii package updated

2011-02-28 Thread David Hajage
Hi, I have uploaded a new version of the ascii package, it should be availble on CRAN soon. Major new features are: - pandoc support (http://johnmacfarlane.net/pandoc/) - an alternative to the Sweave "way" to create reports: see ?Report. This feature needs a working installation of asciidoc, tx

[R] unstructured correlation matrix in lme

2008-06-25 Thread David Hajage
Hello R users, I'm student and I'm actually having a lecture introducing repeated mesures analysis. Unfortunately, all examples use SAS system... I'm working with lme function (package "nlme"), and I'm using extract.lme.cov (package "mgcv") to extract covariance structure of models. One example

Re: [R] unstructured correlation matrix in lme

2008-06-25 Thread David Hajage
0.8218556 5 0.2125583 0.3115286 0.5573176 0.8218556 1.000 2008/6/25 David Hajage <[EMAIL PROTECTED]>: > Hello R users, > > I'm student and I'm actually having a lecture introducing repeated mesures > analysis. Unfortunately, all examples use SAS system... > > I

Re: [R] unstructured correlation matrix in lme

2008-06-26 Thread David Hajage
different functions (gls and lme), and two parameters (one for variance structure, one for correlation structure). I needed too much time to understand this. My mistake. david 2008/6/25 David Hajage <[EMAIL PROTECTED]>: > I would like to make clear that the SAS "unstructured"

Re: [R] odfWeave and xtable

2008-01-16 Thread David Hajage
It is verry easy with xtable package to make your own "xtable.class" function, if the "class" was not implemented in xtable package yet. It would be wonderfull if odfWeave include a framework to make such things. Ps : I would like to know if there is an R project to include all existing format ou

Re: [R] odfWeave and xtable

2008-01-17 Thread David Hajage
n after. I know that the syntax of the input file could be too difficult for newbie users (that's why odfWeave is very usefull), but this can be bypass a specific editor like kile for latex... 2008/1/16, Max Kuhn <[EMAIL PROTECTED]>: > > 2008/1/16 David Hajage <[EMAIL PROTECTED

Re: [R] Help with coxph object

2008-01-21 Thread David Hajage
hello, it is in the summary.coxph object : > names(summary(yourcoxobject)) You can see '$coef' > summary(yourcoxobject)$coef[,5] 2008/1/21, Eleni Christodoulou <[EMAIL PROTECTED]>: > > Hello R community! > > I am trying to apply the cox model and thus I am creating a coxph object. > I > would l

Re: [R] Combining all possible values of variables into a new...

2008-10-20 Thread David Hajage
or if x, y and z are factors : > dbis <- as.data.frame(apply(d, 2, as.factor) > dbis$x:dbis$y:dbis$z [1] 1:1:1 0:3:2 0:2:1 1:3:2 0:2:1 0:1:2 1:2:1 0:3:2 0:2:1 1:3:2 12 Levels: 0:1:1 0:1:2 0:2:1 0:2:2 0:3:1 0:3:2 1:1:1 1:1:2 1:2:1 ... 1:3:2 and for your results : > as.numeric(dbis$x:dbis$y:dbis$

Re: [R] Calculating Sensitivity, Specificity, and Agreement from Logistics Regression Model

2008-12-18 Thread David Hajage
Deer Meir, You could take a look at lroc() from epicalc package. Or calculate all that yourself : the linear fit of the model are in yourmodel$linear.predicators Best regards, david 2008/12/18 Meir Preiszler > Hi, > > Assume I have a variable Y having two discrete values and two predictor > v

[R] Problem with ggplot2 - facet_wrap and boxplot

2009-01-07 Thread David Hajage
Hello R users and Hadley, Back again with a little problem in ggplot2 =o) (ggplot 0.8.1, R 2.8.0) Here the problem : library(ggplot2) df <- data.frame(id = 1:100, x1 = c(rnorm(50), rnorm(50, 1)), x2 = c(rnorm(50), rnorm(50, 1.5)), x3 = c(rnorm(50, 0.5), rnorm(50, 2.5)), group = as.factor(rep(c(

Re: [R] Problem with ggplot2 - facet_wrap and boxplot

2009-01-07 Thread David Hajage
o. Well, it's working (replace 'group' by 'trt') Thank you very much Hadley. david 2009/1/7 hadley wickham > Hi David, > > > Here the problem : > > > > library(ggplot2) > > > > df <- data.frame(id = 1:100, x1 = c(rnorm(50), rnorm(50, 1)), x2 = > > c(rnorm(50), rnorm(50, 1.5)), x3 = c(rnor

[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] 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 backsl

Re: [R] connecting boxplots

2009-01-12 Thread David Hajage
Or with package ggplot2 : library(ggplot2) c <- qplot(cyl, mpg, data=mtcars) c + geom_boxplot(aes(group = factor(cyl))) + stat_summary(fun = median, geom = "line", colour = "red") + stat_summary(fun = function(x) min(x), geom = "line", colour = "blue") + stat_summary(fun = function(x) max(

[R] error message with roxygen

2009-01-30 Thread David Hajage
Hello useRs, I'm trying to use the Roxygen package. Here my code file : #' A packge to check Roxygen's sanity #' @name helloRoxygen-package #' @docType package NA And my R code to generate the package : library(roxygen) package.skeleton("helloRoxygen", code_files = "roxy.r", force = T) roxygeniz

[R] sub question

2009-01-30 Thread David Hajage
Hello R users, I have a string, for example: x <- "\t\tabc\t def" This string can contain any number of tabulations. I want to replace each tabulation of the begining of the string by the same number of space: " abc\t def" I'm trying to do this with gsub : > gsub("\t", " ", x) # replace every \

Re: [R] sub question

2009-01-31 Thread David Hajage
Thank you, it's perfect. david 2009/1/30 Wacek Kusnierczyk > David Hajage wrote: > > Hello R users, > > > > I have a string, for example: > > x <- "\t\tabc\t def" > > > > This string can contain any number of tabulations. I want to rep

Re: [R] error message with roxygen

2009-02-02 Thread David Hajage
ocs." But I can't understand what I must do in my short example... Thank you for any help. david 2009/1/30 David Hajage > Hello useRs, > > I'm trying to use the Roxygen package. > > Here my code file : > #' A packge to check Roxygen's sanity >

Re: [R] error message with roxygen

2009-02-02 Thread David Hajage
Thank you Hadley! 2009/2/2 hadley wickham > On Fri, Jan 30, 2009 at 3:49 AM, David Hajage wrote: > > Hello useRs, > > > > I'm trying to use the Roxygen package. > > > > Here my code file : > > #' A packge to check Roxygen's sanity >

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread David Hajage
2009/2/19 baptiste auguie > Perhaps you can try this, > > d <- c(0.00377467, 0.00377467, 0.00377467, 0.00380083, 0.00380083, >> 0.00380083, >> 0.00380959, 0.00380959, 0.00380959, 0.00380083, 0.00380083, >> 0.00380083) >> >> c( t( cbind(matrix(d, ncol=3, byrow=T), 0))) >> >> > I don't k

Re: [R] table with 3 variables

2009-02-19 Thread David Hajage
"And I would like to group the Subject by Quarter using as a result in the table the value of the third variable (Boolean). The final result would give: Subjet Q1 Q2 Q3 Q4 1100 Y Y Y Y 2101 N N N N" Are you sure that this is the final result you want ? You could use the reshape

Re: [R] table with 3 variables

2009-02-19 Thread David Hajage
Sorry, you don't need 'melt' : cast(truc, Subject ~ Quarter) 2009/2/19 David Hajage > "And I would like to group the Subject by Quarter using as a result in the > table the value of the third variable (Boolean). The final result would > give: > > Subjet Q1

[R] ggplot2 - two or more axis

2008-11-14 Thread David Hajage
Hello R users, I'm trying to learn how to make a plot with the amazing package ggplot2. I was wondering if it was possible to draw 2 (or more) x (or y) axis in the same graph. For example : - I want to show two informations at each x coordinate : a survival curve, I want to show the time (0, 12

Re: [R] the number of the arguments of function is not sure

2008-11-14 Thread David Hajage
You could try something like this : plot_test <- function(...) { args <- list(...) par(mfrow = c(length(args), 1)) lapply(args, plot) } plot_test(1:5) plot_test(1:5, 5:1, 3:7) 2008/11/14 Chang Jia-Ming <[EMAIL PROTECTED]> > I want to write a function to plot a picture for each inputting fi

Re: [R] ggplot2 - two or more axis

2008-11-15 Thread David Hajage
Thank you very much for the answer. I have seen very often the number of subject at risk on survival graph (see my pdf file). It is very easy to plot the curve with geom_step(), but is there a better way to show the number of subjects at risk at each time ? Thank you for your advice. 2008/11/14

[R] Problem with ggplot2

2008-11-20 Thread David Hajage
Hello R users, I have an error with package ggplot2 under linux (ubuntu 8.10), R 2.8.0 and ggplot2 0.7, everything up to date : > library(ggplot2) Le chargement a nécessité le package : grid Le chargement a nécessité le package : reshape Le chargement a nécessité le package : plyr Le chargement a

[R] ggplot2 - Problem with geom_abline()

2008-11-21 Thread David Hajage
Hello, Sorry to ask again something with ggplot2... I detect something, perhaps a bug (but more probably a syntax error, I'm learning...) : # This is working : x = wt, y = mpg, abline with intercept = 20 and slope = 1 qplot(wt, mpg, data = mtcars) + geom_abline(intercept = 20, slope = 1) # This

Re: [R] ggplot2 - facet_grid and facet_wrap

2008-11-24 Thread David Hajage
gt; Regards, > > Hadley > > On Sat, Nov 22, 2008 at 1:07 PM, David Hajage <[EMAIL PROTECTED]> wrote: > > Hello R users (and Hadley) > > > > I have another question about ggplot2 :-) > > > > (version 0.8) > > > > `dat` <- > > structur

[R] ggplot2 - suggestion for facet_wrap/grid

2008-12-03 Thread David Hajage
Hello R users (and Hadley), facet_wrap and facet_grid function are both very usefull. But they are perhaps a bit redundant. I probably don't see the advantage of two separate functions, but what do you think of this suggestion : add 'nrow' and 'ncol arguments to facet_grid. These arguments would

Re: [R] ggplot2 facet_wrap problem

2008-12-03 Thread David Hajage
yes, I think this is the bug that will be fixed in the next release : http://github.com/hadley/ggplot2/tree/master/NEWS 2008/12/3 ONKELINX, Thierry <[EMAIL PROTECTED]> > Hi Stephen, > > It looks like a bug in facet_wrap which seems to mix up the factor > labels (by sorting only the labels but not

[R] Fwd: ggplot2 - suggestion for facet_wrap/grid

2008-12-03 Thread David Hajage
2008/12/3 hadley wickham <[EMAIL PROTECTED]> > Hi David, > > > facet_wrap and facet_grid function are both very usefull. But they are > > perhaps a bit redundant. > > I disagree ;) I was sure :-) > Conceptually they are rather different: facet_wrap is > essentially a 1d layout, while facet_gri

Re: [R] How to add accuracy, sensitivity, specificity to logistic regression output?

2008-12-10 Thread David Hajage
You could calculate this yourself, with the result object ( yourobject$linear.predicators). 2008/12/9 pufftissue pufftissue <[EMAIL PROTECTED]> > Hi, > > Is there a way when doing logistic regression for the output to spit out > accuracy, sensitivity, and specificity? > > I would like to know the

Re: [R] merging data.frames columnwise (rbind with different variables, lengths)

2008-12-11 Thread David Hajage
Dear Stefan, You could use rbind.fill() from reshape package : > install.packages("reshape") > library(reshape) > df1 <- data.frame(A = c(1,2), B = c("m","f"), C = c("at home", "away")) > df2 <- data.frame(A = c(2), C = c("at home")) > rbind.fill(df1, df2) AB C 1 1m at home 2 2