Re: [R] Summarizing each row into a frequency table

2009-03-23 Thread Peter Alspach
Tena koe Daren One alternative: apply(m, 1, function(x) 100*summary(factor(x, levels=-1:1))/length(x[!is.na(x)])) Doubtless there are others. HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Daren T

[R] A question about rJava and the classpath

2009-03-23 Thread Saptarshi Guha
Hello, Since this an R package, I'm sending the email. I'm loading all the jar files as: library(rJava) hadoop <- Sys.getenv("HADOOP") allfiles <- c(list.files(hadoop,pattern="jar$",full.names=T),list.files(paste(hadoop,"lib",sep=.Platform$file.sep,collapse=""),pattern="jar$",full.names=T)) allfi

Re: [R] How to set up a function for "Central Limit Theorem"

2009-03-23 Thread G. Jay Kerns
Dear Ivan, On 3/23/09, pfc_ivan wrote: > > Hello guys, I am stuck here: > > How do I make 1000 samples of n = 10 observations from an Exponential > distribution and then compute the mean for all those 1000 samples? > The R Commander will do this. See the menus Distributions -> Continuous -> Exp

Re: [R] If statement generates two outputs

2009-03-23 Thread Berwin A Turlach
G'day Carl, On Mon, 23 Mar 2009 20:11:19 -0400 Carl Witthoft wrote: > >From: Wacek Kusnierczyk > >Date: Sun, 22 Mar 2009 22:58:49 +0100 > > > >just for fun, you could do this with multiassignment, e.g., using > >the (highly experimental and premature!) rvalues: > > >source('http://m

Re: [R] Summarizing each row into a frequency table

2009-03-23 Thread Gabor Grothendieck
Try this (haven't checked the speed): f <- function(x) table(factor(x, c(-1, 0, 1))) 100 * prop.table(t(apply(m, 1, f)), 1) On Mon, Mar 23, 2009 at 8:46 PM, Daren Tan wrote: > I have a matrix containing -1, 0, 1, however certain rows will not > have all 3 numbers. I have written some codes to c

Re: [R] two different date formats in the same variable

2009-03-23 Thread Gabor Grothendieck
Try this: > library(chron) > x <- c("06/25/04", "06/25/2004", "03/03/59", "03/03/1959") > chron(x) [1] 06/25/04 06/25/04 03/03/59 03/03/59 On Mon, Mar 23, 2009 at 8:06 PM, Farrel Buchinsky wrote: > How does one convert to a date format when survey respondents have > used two different date form

Re: [R] .Internal

2009-03-23 Thread Berwin A Turlach
G'day Kevin, On Mon, 23 Mar 2009 18:48:16 -0400 wrote: > Sorry to be so dense but the article that you suggest does not give > any information on how the arguments are packed up. I look at the > call: > > val <- .Internal(fmin(function(arg) -f(arg, ...), lower, upper, tol)) > > and then with t

[R] Properly labeling abline with text?

2009-03-23 Thread Jason Rupert
The result of the code shown below is posted at the following URL: http://n2.nabble.com/Trying-to-properly-label-abline-td2524629.html I would like to figure out a better way to label the horizontal abline. I tried multiplying the text y position by a scale, but this didn't always put the text

Re: [R] Properly labeling abline with text?

2009-03-23 Thread David Winsemius
?rect -- David Winsemius On Mar 23, 2009, at 11:01 PM, Jason Rupert wrote: The result of the code shown below is posted at the following URL: http://n2.nabble.com/Trying-to-properly-label-abline-td2524629.html I would like to figure out a better way to label the horizontal abline. I t

[R] confidence interval or error of x intercept of a linear regression

2009-03-23 Thread Kevin J Emerson
Hello all, This is something that I am sure has a really suave solution in R, but I can't quite figure out the best (or even a basic) way to do it. I have a simple linear regression that is fit with lm for which I would like to estimate the x intercept with some measure of error around it (conf

Re: [R] Properly labeling abline with text?

2009-03-23 Thread Gabor Grothendieck
Try this: library(plotrix) plot(x_vals, y_vals) abline(h=min(y_vals), col="darkred") boxed.labels(max(x_vals) - strwidth(bottom_label)/2, min(y_vals) + strheight(bottom_label), bottom_label) See ?boxed.labels for more. On Mon, Mar 23, 2009 at 11:01 PM, Jason Rupert wrote: > > The result of the

[R] help: what are the basis functions in {mgcv}: gam?

2009-03-23 Thread oliviax
I am writing my thesis with the function gam(), with the package {mgcv}. My command is: gam(y~s(x1,bs="cr")+s(x2, bs="cr")). I need help to know what are the default basis funcitons for gam. I have not found any detailed reference for this. Can anyone help me with this?? -- View this messa

[R] Legend containing maths symbol and values of variables

2009-03-23 Thread Daren Tan
I need to have the maths symbol for >= in the legend, and to substitute threshold variable with its value. Somehow, various attempts weren't successful. Please help. threshold <- 0.5 plot(NA, xlab="", ylab="", main="", axes=F, xlim=c(0,1), ylim=c(0,1), xaxs="i", yaxs="i") legend(x=0, y=1, fill=c(

Re: [R] help: what are the basis functions in {mgcv}: gam?

2009-03-23 Thread Andrew Robinson
Try Wood S.N. (2006) Generalized Additive Models: An Introduction with R. Chapman and Hall/CRC Press. listed in the references in the help file of the function. It's a great read. Andrew On Mon, Mar 23, 2009 at 07:36:44PM -0700, oliviax wrote: > > I am writing my thesis with the fun

Re: [R] Legend containing maths symbol and values of variables

2009-03-23 Thread andrew
the plotmath help page should give the answer http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/base/html/plotmath.html On Mar 24, 2:53 pm, Daren Tan wrote: > I need to have the maths symbol for >= in the legend, and to > substitute threshold variable with its value. Somehow, various > attemp

Re: [R] Legend containing maths symbol and values of variables

2009-03-23 Thread Gabor Grothendieck
For the legend argument try this: leg = as.expression(c(sprintf("Up (>= %d)", threshold), "Normal", "Down", "NA")) or use paste in place of sprintf. On Mon, Mar 23, 2009 at 11:53 PM, Daren Tan wrote: > I need to have the maths symbol for >= in the legend, and to > substitute threshold v

Re: [R] newton method

2009-03-23 Thread Yihui Xie
I'm not sure what you meant by "a topic on newton's method" (algorithm? demo?), but the demonstration in the package 'animation' might help: install.packages('animation') par(pch = 20) ani.options(nmax = 50) newton.method(function(x) 5 * x^3 - 7 * x^2 - 40 * x + 100, 7.15, c(-6.2, 7.1)) Regar

Re: [R] Legend containing maths symbol and values of variables

2009-03-23 Thread Daren Tan
I tried sprintf and paste, which solves one of my problem i.e. replacing the variable name by its value. However, >= is not renderend correctly as the inequality symbol. On Tue, Mar 24, 2009 at 12:24 PM, Gabor Grothendieck wrote: > For the legend argument try this: > > leg = as.expression(c(sprin

<    1   2