[R] apply over parallel lists and their elements

2010-09-11 Thread Sebastian Gibb
Hello, I have a list like the following: tree<-list(); tree[[1]]$node<-list(); tree[[2]]$node<-list(); tree[[1]]$node$values <- 1:10 tree[[2]]$node$values <- 1:10 After building the list I have to generate the mean of all "values" elements with equal indices. Until now I use something like that

Re: [R] R-equivalent Stata command: poisson or quasipoisson?

2010-09-11 Thread Wil M Contreras Arbaje
Thanks Bill! Not asking for help with Stata at all, on the contrary: the article mentioned using Stata to fit the model described earlier, and I wasn't sure how to do the same in R (which is what I've used since college). Thanks again, I'll play around a bit glmRob, see what happens (though

Re: [R] R-equivalent Stata command: poisson or quasipoisson?

2010-09-11 Thread Bill.Venables
In R, the glm families poisson and quasipoisson will give you the same estimates. Their standard errors will (usually) be different, though, and family = quasipoisson does not give you an AIC (since it does not maximise a true likelihood; it uses quasi-likelihood estimation). I hope you are no

Re: [R] Generating multinomial distribution and plotting

2010-09-11 Thread thedreamshaper
Hi, I actually largely solved the problem, i am using this code: var1 <- rnorm(5000,0,5) var2 <- 0.90*var1+0.10*rnorm(5000,0,10) plot(var1,var2) Its somewhat simplistic to say the least but it works more or less, i will definantly look into your suggestion though! Thanks Thor Denmark On Sun

[R] R-equivalent Stata command: poisson or quasipoisson?

2010-09-11 Thread Wil M Contreras Arbaje
Hello R-help, According to a research article that covers the topic I'm analyzing, in Stata, a Poisson pseudo-maximum-likelihood (PPML) estimation can be obtained with the command poisson depvar_ij ln(indepvar1_ij) ln(indepvar2_ij) ... ln(indepvarN_ij), robust I looked up Stata help fo

Re: [R] scalable < > delimiters in plotmath

2010-09-11 Thread David Winsemius
On Sep 11, 2010, at 9:00 PM, Peter Ehlers wrote: On 2010-09-11 16:14, Dennis Murphy wrote: Hi Baptiste, You need to use the symbol("\nnn") concept, where nnn denotes the octal symbol number. For< it's 074 and for> it's 076. This little test seemed to work: plot(1, 1, main = expression

Re: [R] scalable < > delimiters in plotmath

2010-09-11 Thread Peter Ehlers
On 2010-09-11 16:14, Dennis Murphy wrote: Hi Baptiste, You need to use the symbol("\nnn") concept, where nnn denotes the octal symbol number. For< it's 074 and for> it's 076. This little test seemed to work: plot(1, 1, main = expression(symbol("\074")~'x, y'~symbol("\076"))) HTH, Dennis It

Re: [R] mapping array

2010-09-11 Thread Bill.Venables
Is this the kind of thing you are talking about? ### 8< cut here 8< ### A <- rep(NA, 100) B <- sort(runif(25)) C <- sort(sample(1:100, 25)) A[C] <- B B C A ### 8< cut here 8< ### (The sorting is not necessary. It's only there to make checking what happened easier.) -Original Message---

Re: [R] mapping array

2010-09-11 Thread Joshua Wiley
Hi Greg, I am sketchy on a few details of C, but does something like this work for you? I just created C1 (renamed because C() is a function) with two columns the first corresponding to A and the second to B. Then I just used the first column to select elements of A and the second to select elem

Re: [R] Generating multinomial distribution and plotting

2010-09-11 Thread Peng, C
Oh,You actually want a mixture of two different normal random variables. -- View this message in context: http://r.789695.n4.nabble.com/Generating-multinomial-distribution-and-plotting-tp2535895p2536026.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Supplying function inputs interactively

2010-09-11 Thread Peng, C
Is this what you would expect to have. Definitely you can make this function more elegant: fn1 <- function(x = 10) { cat("Please type the option number to get your Y value:\n\n") cat(" 1. Y = 1.\n 2. Y = 2.\n 3. Use the default y.\n 4. Choose my own value for y.\n\n") opt=scan

Re: [R] Supplying function inputs interactively

2010-09-11 Thread Gabor Grothendieck
On Sat, Sep 11, 2010 at 7:17 PM, Christofer Bogaso wrote: > Dear all, I am looking for some procedure to send inputs to a function > interactively. Here is an example: > > fn1 <- function(x = 10) { > y <- 0 > # ask user whether he wants to put some other value for "y" > # R will show 2 options: 1.

Re: [R] Supplying function inputs interactively

2010-09-11 Thread Peng, C
Have you tried scan()?: > y=scan() 1: 2 2: Read 1 item > y [1] 2 -- View this message in context: http://r.789695.n4.nabble.com/Supplying-function-inputs-interactively-tp2536003p2536004.html Sent from the R help mailing list archive at Nabble.com. ___

[R] Supplying function inputs interactively

2010-09-11 Thread Christofer Bogaso
Dear all, I am looking for some procedure to send inputs to a function interactively. Here is an example: fn1 <- function(x = 10) { y <- 0 # ask user whether he wants to put some other value for "y" # R will show 2 options: 1. y = 2 # 2. y = 3 # user will choose ei

[R] mapping array

2010-09-11 Thread Gregory Ryslik
Hi, Suppose I have array A with 100 elements all filled in with "N/A". Array B has 25 elements with actual values. Lastly, I have array C that provides a map of where to put the elements from array A into array B. Thus C would say put element 1 from B into element 3 from array A. I realize

Re: [R] Setting scales for ggplot2 with facets

2010-09-11 Thread Dennis Murphy
Use scales = 'free' in facet_wrap() to vary both scales across panels. From Ch. 7 of the ggplot2 book, the options are (in either type of faceting) scales = 'fixed' => both x and y scales are fixed in all plots scales = 'free_x'=> fix y scale, vary x scale across panels scales = 'free_y'

Re: [R] Generating multinomial distribution and plotting

2010-09-11 Thread Dennis Murphy
Hi: Do you mean multinomial or multivariate normal? If the latter, then in addition to the previous response, there is package mvtnorm and a function mvrnorm() in the MASS package to generate correlated multivariate normal samples. HTH, Dennis On Sat, Sep 11, 2010 at 12:52 PM, thedreamshaper wro

Re: [R] scalable < > delimiters in plotmath

2010-09-11 Thread Dennis Murphy
Hi Baptiste, You need to use the symbol("\nnn") concept, where nnn denotes the octal symbol number. For < it's 074 and for > it's 076. This little test seemed to work: plot(1, 1, main = expression(symbol("\074")~'x, y'~symbol("\076"))) HTH, Dennis On Sat, Sep 11, 2010 at 10:01 AM, baptiste augu

[R] sorting a (homogenous) list of objects, based on a a field of the objects

2010-09-11 Thread Rajarshi Guha
Him I have a list of S4 objects. Each object has a field called name, and what I'd like to do is to sort the list based on the value of name. Currently I'm using the following code tmp <- unlist(lapply(fps, function(x) as.integer(x...@name))) tmp <- order(tmp, decreasing=FALSE) fps <- fps[ tmp ]

Re: [R] confidence bands for a quasipoisson glm

2010-09-11 Thread Peng, C
Is this something you want to have (based on a simulated dataset)? counts <- c(18,17,15,20,10,20,25,13,12) #risk <- round(rexp(9,0.5),3) risk<- c(2.242, 0.113, 1.480, 0.913, 5.795, 0.170, 0.846, 5.240, 0.648) gm <- glm(counts ~ risk, family=quasipoisson) summary(gm) new.risk=seq(min(risk), max(r

Re: [R] Setting scales for ggplot2 with facets

2010-09-11 Thread Sven Laur
This does not solve the problem, as I still do not know how to control the y-range for individual facets. Data contains some outliers which make the y-range too wide for me and I would explicitly set the ylim = c(0,10) for facet "A" and ylim = c(42, 102) for facet "B". How should I do it? On 11 S

Re: [R] Generating multinomial distribution and plotting

2010-09-11 Thread Peng, C
package: {mnormt} -- View this message in context: http://r.789695.n4.nabble.com/Generating-multinomial-distribution-and-plotting-tp2535895p2535934.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list http

Re: [R] Setting scales for ggplot2 with facets

2010-09-11 Thread Jonathan Christensen
Swen, facet_grid forces the scale for plots along an axis to be shared. Try facet_wrap instead. Jonathan On Sat, Sep 11, 2010 at 2:21 PM, Sven Laur wrote: > Faceting in ggplot2 seems to permit different scales for different facets, > but I fail > to see how one could control ylim and xlim ran

[R] Setting scales for ggplot2 with facets

2010-09-11 Thread Sven Laur
Faceting in ggplot2 seems to permit different scales for different facets, but I fail to see how one could control ylim and xlim ranges for each facet separately. For instance, I would like to set the ylim = c(0,10) for facet "A" and ylim = c(42,102) for facet "B". Since the data is out of th

Re: [R] confidence bands for a quasipoisson glm

2010-09-11 Thread David Winsemius
On Sep 11, 2010, at 3:15 PM, Maik Rehnus wrote: Dear all, I have a quasipoisson glm for which I need confidence bands in a graphic: gm6 <- glm(num_leaves ~ b_dist_min_new, family = quasipoisson, data = beva) summary(gm6) library('VIM') b_dist_min_new <- as.numeric(prepare(beva$dist_mi

[R] Generating multinomial distribution and plotting

2010-09-11 Thread thedreamshaper
I have had plenty of succes generating one dimensional variables and plotting them, but what do i do for more (specifically 2) dimensional multinomial variables? I figure i have to create a vector consisting of two 1 dim normallly distributed variables, that way i can also control the correlatio

[R] confidence bands for a quasipoisson glm

2010-09-11 Thread Maik Rehnus
Dear all, I have a quasipoisson glm for which I need confidence bands in a graphic: gm6 <- glm(num_leaves ~ b_dist_min_new, family = quasipoisson, data = beva) summary(gm6) library('VIM') b_dist_min_new <- as.numeric(prepare(beva$dist_min, scaling="classical", transformation="logarithm")). My

[R] [Q] How to extract cross validation results from e1071's svm model

2010-09-11 Thread GMail (KU)
Dear all, Is it possible to extract cross-validation results from e1071's svm model? For example, the following R code shows the result from the 10 fold cross-validation. model = svm(spam ~ ., data = spam, cross = 10) summary(model) But, I could not figure out how to get to the accuracy values

Re: [R] Solver in R

2010-09-11 Thread Berend Hasselman
Another idea. >From your formulation it seems that r does not depend on t and Xt so you wouldn't need a solver. You could solve for r explicitly so r <- R0/sum(Xt) /Berend -- View this message in context: http://r.789695.n4.nabble.com/Solver-in-R-tp2535115p2535815.html Sent from the R help ma

Re: [R] Solver in R

2010-09-11 Thread Berend Hasselman
You can also have a look at and try package nleqslv. Berend -- View this message in context: http://r.789695.n4.nabble.com/Solver-in-R-tp2535115p2535813.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing li

Re: [R] scalable < > delimiters in plotmath

2010-09-11 Thread baptiste auguie
What do people use to show angle brackets < > in R graphics? Have I missed something obvious? Thanks, baptiste On 9 September 2010 17:57, baptiste auguie wrote: > Dear list, > > I read in ?plotmath that I can use bgroup to draw scalable delimiters > such as [ ] and ( ). The same technique fails

Re: [R] xlab with text and expression

2010-09-11 Thread threshold
thanks a lot! -- View this message in context: http://r.789695.n4.nabble.com/xlab-with-text-and-expression-tp2535732p2535785.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailma

Re: [R] Latex fonts in R graphics

2010-09-11 Thread Dennis Murphy
Hi: This doesn't directly answer your question, but you may want to investigate the tikzDevice package. From its DESCRIPTION file: The TikZ device enables LaTeX-ready output from R graphics functions. This is done by producing code that can be understood by the TikZ graphics language. All text in

Re: [R] Solver in R

2010-09-11 Thread Carl Witthoft
Use BBsolve in the BB package. It'll do darn near anything. Carl __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, mi

Re: [R] approxfun-problems (yleft and yright ignored)

2010-09-11 Thread Samuel Wuest
Hi Martin, indeed, as mentioned in the bug-report, the results are inconsistent, and each time I rerun, I get different results... Sometimes, the range is correct even on my machine, but mostly I get values >1 back: Here is another run: > ### load the data: a list called approx.data > load(file=

Re: [R] approxfun-problems (yleft and yright ignored)

2010-09-11 Thread Martin Maechler
> Duncan Murdoch > on Sat, 11 Sep 2010 11:23:02 -0400 writes: > On 11/09/2010 11:13 AM, Martin Maechler wrote: >>> Duncan Murdoch >>> on Sat, 11 Sep 2010 10:32:38 -0400 writes: >> >> > On 11/09/2010 10:04 AM, Martin Maechler wrote: >> >>> "SW" ==

Re: [R] approxfun-problems (yleft and yright ignored)

2010-09-11 Thread Duncan Murdoch
On 11/09/2010 11:13 AM, Martin Maechler wrote: Duncan Murdoch on Sat, 11 Sep 2010 10:32:38 -0400 writes: > On 11/09/2010 10:04 AM, Martin Maechler wrote: >>> "SW" == Samuel Wuest >>> on Thu, 26 Aug 2010 14:34:26 +0100 writes: >> SW> Hi Greg, SW> thanks fo

Re: [R] xlab with text and expression

2010-09-11 Thread David Winsemius
On Sep 11, 2010, at 11:07 AM, threshold wrote: Dear R users, say plot(rnorm(1)~rnorm(1), xlab=paste('abc', expression(x>=1)), plot(rnorm(1)~rnorm(1), xlab=expression(abc~x >= 1)) # or if you are uncertain whether abc is a plotmath-special then this also works plot(rnorm(1)~rnorm(1), xla

Re: [R] approxfun-problems (yleft and yright ignored)

2010-09-11 Thread Martin Maechler
> Duncan Murdoch > on Sat, 11 Sep 2010 10:32:38 -0400 writes: > On 11/09/2010 10:04 AM, Martin Maechler wrote: >>> "SW" == Samuel Wuest >>> on Thu, 26 Aug 2010 14:34:26 +0100 writes: >> SW> Hi Greg, SW> thanks for the suggestion: >> SW> I hav

Re: [R] approxfun-problems (yleft and yright ignored)

2010-09-11 Thread Duncan Murdoch
On 11/09/2010 10:53 AM, Martin Maechler wrote: "MM" == Martin Maechler on Sat, 11 Sep 2010 16:04:37 +0200 writes: "SW" == Samuel Wuest on Thu, 26 Aug 2010 14:34:26 +0100 writes: SW> Hi Greg, SW> thanks for the suggestion: SW> I have attached some small dataset that can

[R] xlab with text and expression

2010-09-11 Thread threshold
Dear R users, say plot(rnorm(1)~rnorm(1), xlab=paste('abc', expression(x>=1)), I want proper sign of weak inequality not just '>=' will appreciate! robert -- View this message in context: http://r.789695.n4.nabble.com/xlab-with-text-and-expression-tp2535732p2535732.html Sent from the R help ma

Re: [R] approxfun-problems (yleft and yright ignored)

2010-09-11 Thread Martin Maechler
> "MM" == Martin Maechler > on Sat, 11 Sep 2010 16:04:37 +0200 writes: > "SW" == Samuel Wuest > on Thu, 26 Aug 2010 14:34:26 +0100 writes: SW> Hi Greg, SW> thanks for the suggestion: SW> I have attached some small dataset that can be used to reproduce the

[R] ggplot: stat_smooth() and nls method

2010-09-11 Thread Benoit Boulinguiez
Hi all, Does one of you know if there is any way to combine a "nls" method in the stat_smooth of ggplot? Regards -- - Benoit Boulinguiez Ph.D student Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes" Avenue du Général Leclerc CS

[R] outputting arima models

2010-09-11 Thread lord12
sseq <- c(1, seq(5, 120, by = 5)) for(i in 1:length(sseq)){ assign(paste("arima", i, sep=""), arima0(data.ts[sseq[i]:(sseq[i]+115)], order=c(1,1,1))) } pred1 = predict(arima1, n.ahead = 5, se.fit = TRUE)$pred how do I traverse the arima models so I repeat the above prediction procedure(bold) on

Re: [R] approxfun-problems (yleft and yright ignored)

2010-09-11 Thread David Winsemius
On Sep 11, 2010, at 10:04 AM, Martin Maechler wrote: "SW" == Samuel Wuest on Thu, 26 Aug 2010 14:34:26 +0100 writes: SW> Hi Greg, SW> thanks for the suggestion: SW> I have attached some small dataset that can be used to reproduce the SW> odd behavior of the approxfun-funct

Re: [R] approxfun-problems (yleft and yright ignored)

2010-09-11 Thread Duncan Murdoch
On 11/09/2010 10:04 AM, Martin Maechler wrote: "SW" == Samuel Wuest on Thu, 26 Aug 2010 14:34:26 +0100 writes: SW> Hi Greg, SW> thanks for the suggestion: SW> I have attached some small dataset that can be used to reproduce the SW> odd behavior of the approxfun-function.

Re: [R] approxfun-problems (yleft and yright ignored)

2010-09-11 Thread Martin Maechler
> "SW" == Samuel Wuest > on Thu, 26 Aug 2010 14:34:26 +0100 writes: SW> Hi Greg, SW> thanks for the suggestion: SW> I have attached some small dataset that can be used to reproduce the SW> odd behavior of the approxfun-function. SW> If it gets stripped off my ema

Re: [R] bootstrapping

2010-09-11 Thread David Winsemius
On Sep 11, 2010, at 9:50 AM, Gregory Ryslik wrote: Hi Everyone, I am implementing a special case of Random forests. At one point, I have a list of which I then sample for replacement. So if the list is 100 elements, I get 100 elements some of them duplicates. How can I easily get the ele

[R] bootstrapping

2010-09-11 Thread Gregory Ryslik
Hi Everyone, I am implementing a special case of Random forests. At one point, I have a list of which I then sample for replacement. So if the list is 100 elements, I get 100 elements some of them duplicates. How can I easily get the elements that were not included in the list? I realize i can

Re: [R] nonlinear programming package

2010-09-11 Thread Ravi Varadhan
There are currently 2 packages that can be of help for solving the type of problems that you are describing: 1. Rsolnp 2. alabama For optimizing nonlinear objective functions subject to linear equality/inequality constraints, you also have the `spg' function in the "BB" package. In contras

Re: [R] Argument lib is missing

2010-09-11 Thread David Winsemius
On Sep 11, 2010, at 8:02 AM, David Winsemius wrote: On Sep 11, 2010, at 6:29 AM, khush wrote: Dear all, I have installed R using yum install R-2.9. I am able to use R for general functions but when I installed some library say gplots I am getting the below error. install.pa

Re: [R] for loop

2010-09-11 Thread David Winsemius
On Sep 11, 2010, at 8:39 AM, Peng, C wrote: or: k=0 for (i in 1:k) if(k>0) print(i) Because of the way the ":" operator works, I would have tested k >=1 > k=0.5 > for (i in 1:k) if (k>0){print(i)} [1] 1 But Gabor's suggestion to use seq_len(k) is cleaner, anyway. -- David Winsemius, MD

Re: [R] 'programatically' list or call objects for use in a function?

2010-09-11 Thread Karl Brand
Cheers Duncan, for your FAST answers and patience. (fast patience?!) I was close. But closer reading of ?save would also have worked i see now :$. LETTERS[] = :) thanks again, Karl On 9/11/2010 2:10 PM, Duncan Murdoch wrote: On 11/09/2010 8:00 AM, Karl Brand wrote: Esteemed R users and dev

Re: [R] for loop

2010-09-11 Thread Peng, C
or: k=0 for (i in 1:k) if(k>0) print(i) -- View this message in context: http://r.789695.n4.nabble.com/for-loop-tp2535626p2535640.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.c

Re: [R] for loop

2010-09-11 Thread Gabor Grothendieck
On Sat, Sep 11, 2010 at 4:39 AM, Yuan Jian wrote: > Hello, > I have a simple question: I want to list numbers 1:k, but if k <1, I hope > nothing listed. > how should we do? > k=2 > for (i in 1:k)  print(i) > [1] 1    # <-correct > [1] 2 > k=0 > for (i in 1:k) print(i) > [1] 1  #< wrong >

Re: [R] for loop

2010-09-11 Thread Michael Bedward
I've been caught out by this more times than I care to admit - forgetting that an R for loop isn't a C for loop. Here's one solution... k <- start.value while (k <= end.value) { # do stuff k <- k + 1 } Michael On 11 September 2010 18:39, Yuan Jian wrote: > Hello, > I have a simple question

[R] for loop

2010-09-11 Thread Yuan Jian
Hello, I have a simple question: I want to list numbers 1:k, but if k <1, I hope nothing listed. how should we do? k=2 for (i in 1:k)  print(i) [1] 1    # <-correct [1] 2 k=0 for (i in 1:k) print(i) [1] 1  #< wrong [1] 0   thanks jian [[alternative HTML version delete

Re: [R] 'programatically' list or call objects for use in a function?

2010-09-11 Thread Duncan Murdoch
On 11/09/2010 8:00 AM, Karl Brand wrote: Esteemed R users and developers, How does one 'programatically' list or call objects for use in a function? It depends on the function. For example, i thought i could do something better than this: save(A.cwb, B.cwb, C.cwb, D.cwb, E.cwb, F.cwb, file

Re: [R] Latex fonts in R graphics

2010-09-11 Thread David Winsemius
On Sep 11, 2010, at 7:18 AM, KARAVASILIS GEORGE wrote: Hello, R users. I am trying to embed Computer modern fonts to an R plot and I get the following error. CM <- Type1Font("CM", + c(paste("cm-lgc/fonts/afm/public/cm-lgc/", + c("fcmr8a.afm", "fcmb8a.afm", "fcmri8a.afm", "f

Re: [R] Argument lib is missing

2010-09-11 Thread David Winsemius
On Sep 11, 2010, at 6:29 AM, khush wrote: Dear all, I have installed R using yum install R-2.9. I am able to use R for general functions but when I installed some library say gplots I am getting the below error. install.packages("gplots") Warning in install.packages("gplots")

[R] 'programatically' list or call objects for use in a function?

2010-09-11 Thread Karl Brand
Esteemed R users and developers, How does one 'programatically' list or call objects for use in a function? For example, i thought i could do something better than this: save(A.cwb, B.cwb, C.cwb, D.cwb, E.cwb, F.cwb, file="afile.RData") with something like these- prfxs <- c("A", "B", "C", "D"

Re: [R] How to comment out entire code parts in Sweave files

2010-09-11 Thread Duncan Murdoch
On 11/09/2010 4:42 AM, Werner W. wrote: Hi, I am wondering if there is any convenient way to comment out an entire region of a Sweave file which comprises R and Latex code. Currently I'm doing it for the R and Latex parts separately or transfer the unwanted part into a different file. But bot

Re: [R] How to check available package

2010-09-11 Thread Duncan Murdoch
On 11/09/2010 12:25 AM, Stephen Liu wrote: Hi folk, How to chcek whether a package is available on R repo? What command shall I run? TIA ?available.packages __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEAS

[R] Latex fonts in R graphics

2010-09-11 Thread KARAVASILIS GEORGE
Hello, R users. I am trying to embed Computer modern fonts to an R plot and I get the following error. CM <- Type1Font("CM", + c(paste("cm-lgc/fonts/afm/public/cm-lgc/", + c("fcmr8a.afm", "fcmb8a.afm", "fcmri8a.afm", "fcmbi8a.afm"), sep=""), + "./cmsyase.afm")) > pdf("cm.pdf",

Re: [R] adding zeroes after old zeroes in a vector ??

2010-09-11 Thread skan
OK thanks to all, I don't need, more Up to this moment the fastest working code is Jonathan Chang's http://stackoverflow.com/questions/3686982/r-adding-zeroes-after-old-zeroes-in-a-vector/3689360#3689360 rr <- rle(tmp) ## Pad so that it always begins with 1 and ends with 1 if (rr$values[1] == 0)

[R] Argument lib is missing

2010-09-11 Thread khush ........
Dear all, I have installed R using yum install R-2.9. I am able to use R for general functions but when I installed some library say gplots I am getting the below error. > install.packages("gplots") Warning in install.packages("gplots") : argument 'lib' is missing: using '/home/fedora/R/i386-r

Re: [R] Over lay 2 scale in same plot

2010-09-11 Thread Jim Lemon
On 09/10/2010 10:43 PM, mamunbabu2001 wrote: Hi Josh, Thanks for your reply. I gave a reply yesterday but found that it was not posted. I managed to plot the bar pot and overlay points. The problem I am facing now is the spread of Y scale. The values I am plotting in Y scale are very close. so

Re: [R] Save R-Part Tree

2010-09-11 Thread Tal Galili
Would using the ?save function on the rpart object do what you want ? Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statist

Re: [R] Traversing a dendrogram object

2010-09-11 Thread Paul Rigor (ucla)
Hi all, I'm trying to traverse a dendrogram object (cast from an hclust clustering). What's the simplest way to obtain the height per leaf node? I suppose I can print the dendrogram text and parse the height values, etc... But is there a way to query for/access a leaf's branch height? Thanks, Pa

Re: [R] convert "1", "10", and "100" to "0001", "0010", "0100" etc.

2010-09-11 Thread Peter Dalgaard
On 09/11/2010 05:00 AM, Peng, C wrote: > > Thanks David. > func() simply prints out the 0010 as a text value. It is still not numeric. > I am just curious about it. > >> is.numeric(func4(0100)) > 00100[1] FALSE > > Well, you can look at the kind of things as.octmode & friends do. The only th

[R] How to comment out entire code parts in Sweave files

2010-09-11 Thread Werner W.
Hi, I am wondering if there is any convenient way to comment out an entire region of a Sweave file which comprises R and Latex code. Currently I'm doing it for the R and Latex parts separately or transfer the unwanted part into a different file. But both are not great solutions. (I am doing t

Re: [R] ggplot bar geom: control the filling in the colour legend

2010-09-11 Thread Benoit Boulinguiez
Sorry my bad, example too simple try that one out. ggplot(diamonds, aes(clarity, fill=color,colour = cut)) + geom_bar(position = "dodge") I want change the filling in the "colour" legend, not the filling of the bars. Regards Le 10/09/2010 20:41, Ista Zahn a écrit : ggplot(diamonds, aes(cl