Re: [R] close specific graphics device

2015-12-16 Thread Henrik Bengtsson
The R.devices package provides functions for this. For instance, you can open several devices with different labels and the close then in whatever order you'd like: > library("R.devices") > devSet("foo") > plot(1:10) > devSet("bar") > plot(10:1) > devSet("foo") > points(10:1) > devSet("bar") > de

Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-16 Thread jwd
On Wed, 16 Dec 2015 07:16:21 -0800 John Kane wrote: ... > > I have lived next door to the USA for most of my life and never > realized that American usage is 'brackets' for [ ] . I would use > the term brackets in normal use for ( ) and "square brackets for [ ]. > ... There's a lot of fog in

Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-16 Thread jwd
On Wed, 16 Dec 2015 09:34:20 -0600 Hadley Wickham wrote: > On Tue, Dec 15, 2015 at 9:55 AM, Martin Maechler > wrote: > > > > > >[] > > > > > You are missing the closing bracket on the boxplot() > > > command. Just finish with a ')' > > > > Hmm... I once learned > > > >

Re: [R] How to bypass the pause in a program invoked using the "system" command

2015-12-16 Thread Jeff Newmiller
You cannot, in general. If the program is written to process the stdin input you might be able to feed it input that it expects, but many DOS/Windows console programs use BIOS to directly access the keyboard. -- Sent from my phone. Please excuse my brevity. On December 16, 2015 5:20:44 PM PST

Re: [R] Applying a function to a matrix using indexes as arguments

2015-12-16 Thread David Winsemius
> On Dec 16, 2015, at 5:34 PM, David Winsemius wrote: > > >> On Dec 16, 2015, at 4:18 PM, Matteo Richiardi >> wrote: >> >> I have to evolve each element of a matrix W >> >> W <- matrix(0,2,3) >> >> according to some function which uses the indices of the matrix [i,j] as >> arguments: >> w.

Re: [R] Applying a function to a matrix using indexes as arguments

2015-12-16 Thread David Winsemius
> On Dec 16, 2015, at 4:18 PM, Matteo Richiardi > wrote: > > I have to evolve each element of a matrix W > > W <- matrix(0,2,3) > > according to some function which uses the indices of the matrix [i,j] as > arguments: > w.fun = function(i,j) { > return A[i]*B[j]/(C[i,j]) > } > > where > A<-

[R] How to bypass the pause in a program invoked using the "system" command

2015-12-16 Thread Zhiqiu Hu
Dear Friends, I want to run a standalone console program (emBayesB) from R script on windows console. However, because the program asks user to press the enter key at each time after the analysis, the R code always stuck after invoking the emBayesB program with the "system()" function. For reprod

Re: [R] Applying a function to a matrix using indexes as arguments

2015-12-16 Thread Jeff Newmiller
Would outer( A, B, `*` ) / C do the trick for you? -- Sent from my phone. Please excuse my brevity. On December 16, 2015 4:41:13 PM PST, Matteo Richiardi wrote: >My problem is of course more complicated, and is obviously not a >homework. >I just wanted to provide a minimal working example. Y

Re: [R] Applying a function to a matrix using indexes as arguments

2015-12-16 Thread Matteo Richiardi
My problem is of course more complicated, and is obviously not a homework. I just wanted to provide a minimal working example. You can replace the matrix C with a matrix containing any number, for what matters. Btw, because numbers are extracted from a Gaussian distribution, the likelihood that you

Re: [R] Applying a function to a matrix using indexes as arguments

2015-12-16 Thread Jeff Newmiller
This calculation divides by values centered around zero. The only context that I can think of that would require such silliness is a homework problem, and this list has a no-homework policy. If not, then mentioning the theory you are applying might help someone point you at an existing function

[R] Applying a function to a matrix using indexes as arguments

2015-12-16 Thread Matteo Richiardi
I have to evolve each element of a matrix W W <- matrix(0,2,3) according to some function which uses the indices of the matrix [i,j] as arguments: w.fun = function(i,j) { return A[i]*B[j]/(C[i,j]) } where A<-c(100,100) B<-c(200,200,200) C <- matrix( rnorm(6,mean=0,sd=1), 2, 3) How can I do it

Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-16 Thread Bert Gunter
... which reminds me of Prof. Henry Higgins's comment in My Fair Lady in the song "Why can't the English" : There even are places where English completely disappears. Why, in America, they haven't used it for years! Cheers, Bert Bert Gunter "The trouble with having an open mind is that people

Re: [R] unable to download library

2015-12-16 Thread David Winsemius
> On Dec 16, 2015, at 3:44 PM, peter dalgaard wrote: > > >> On 17 Dec 2015, at 00:00 , David Winsemius wrote: >> >> When I attempt to open that with Chrome I get an error: >> >> This webpage is not available >> >> DNS_PROBE_FINISHED_NXDOMAIN >> >> Like Bert, I also get an error report when

Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-16 Thread Nordlund, Dan (DSHS/RDA)
Which is why England and the United States have been described as two countries divided by a common language. (Could probably throw Scotland and Australia, and others, into the mix as well ... notice the parethenses, or nice round brackets, or ? :-} ) Dan Daniel Nordlund, PhD Research an

Re: [R] unable to download library

2015-12-16 Thread peter dalgaard
> On 17 Dec 2015, at 00:00 , David Winsemius wrote: > > When I attempt to open that with Chrome I get an error: > > This webpage is not available > > DNS_PROBE_FINISHED_NXDOMAIN > > Like Bert, I also get an error report when I attempt to us the Berkeley repo, > but I do not get an error when

Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-16 Thread Dmitri Leybman
Not a problem at all. I figured the motley crue here couldn't be bracketed into narrow categories. An apparent thesis demonstrated here would be that we all speak a slightly different form of English. :) On Wednesday, December 16, 2015, peter dalgaard wrote: > > > On 16 Dec 2015, at 17:42 , Ha

Re: [R] unable to download library

2015-12-16 Thread Bert Gunter
I would just like to confirm that, like David W. , I am on a Mac. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Dec 16, 2015 at 3:00 PM, Dav

Re: [R] unable to download library

2015-12-16 Thread David Winsemius
> On Dec 16, 2015, at 1:58 PM, Rolf Turner wrote: > > On 17/12/15 07:29, John Karon wrote: >> I am trying to download the “Formula” library using >> install.packages(“Formula”); I have had no problem downloading other >> libraries recently. I receive the error message >> >> Warning: unable to

Re: [R] Graphing the Area of Definite Integral

2015-12-16 Thread peter dalgaard
> On 16 Dec 2015, at 22:09 , David Winsemius wrote: > >>> and look watch the graphs. >> >> Looks fine to me, at least the non-plotmath version? > > Here's a plotmath version that positions the expression in the center of the > plot region. Just in case: I wasn't implying an issue with the pl

Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-16 Thread peter dalgaard
> On 16 Dec 2015, at 17:42 , Hadley Wickham wrote: > > On Wed, Dec 16, 2015 at 9:34 AM, Hadley Wickham wrote: >> On Tue, Dec 15, 2015 at 9:55 AM, Martin Maechler >> wrote: >>> >>> >>> [] >>> You are missing the closing bracket on the boxplot() command. Just finish w

Re: [R] unable to download library

2015-12-16 Thread Rolf Turner
On 17/12/15 07:29, John Karon wrote: I am trying to download the “Formula” library using install.packages(“Formula”); I have had no problem downloading other libraries recently. I receive the error message Warning: unable to access index for repository https://cran.cnr.Berkeley.edu/bin/windows/

Re: [R] unable to download library

2015-12-16 Thread Bert Gunter
Try another repository. I also recently had problems with downloading from Berkeley using secure downloads (https: ) . Switching repositories fixed it for me. Disclaimer: I know next to nothing about internet protocols; so if my suggestion doesn't help, don't ask me why not. I won't have a clue.

Re: [R] Graphing the Area of Definite Integral

2015-12-16 Thread David Winsemius
> On Dec 16, 2015, at 12:24 PM, peter dalgaard wrote: > > >> On 16 Dec 2015, at 20:58 , Steven Stoline wrote: >> >> Dear David: >> >> >> could you please try it for the functions f(x)=x^2 from -4 to 4 and the >> function f(x) = sqrt(x) from 0 to 4, and look watch the graphs. > > Looks fin

Re: [R] Graphing the Area of Definite Integral

2015-12-16 Thread Steven Stoline
Dear David: could you please try it for the functions *f(x)=x^2* from *-4* to *4* and the function *f(x) = sqrt(x)* from *0* to *4*, and look watch the graphs. Thank you very much for your helps. steve On Wed, Dec 16, 2015 at 2:09 PM, David Winsemius wrote: > > > On Dec 16, 2015, at 9:00

[R] unable to download library

2015-12-16 Thread John Karon
I am trying to download the “Formula” library using install.packages(“Formula”); I have had no problem downloading other libraries recently. I receive the error message Warning: unable to access index for repository https://cran.cnr.Berkeley.edu/bin/windows/contrib/3.2 Warning message: package

Re: [R] Graphing the Area of Definite Integral

2015-12-16 Thread peter dalgaard
> On 16 Dec 2015, at 20:58 , Steven Stoline wrote: > > Dear David: > > > could you please try it for the functions f(x)=x^2 from -4 to 4 and the > function f(x) = sqrt(x) from 0 to 4, and look watch the graphs. Looks fine to me, at least the non-plotmath version? -pd > > > Thank you very

Re: [R] Graphing the Area of Definite Integral

2015-12-16 Thread David Winsemius
> On Dec 16, 2015, at 9:00 AM, Steven Stoline wrote: > > Dear William: *Left and Right Riemann Sums* > > > Is there is a way to modify your function to compute Left Riemann Sum and > Right Riemann Sum. I tried to modify yours, but i was not be able to make > it work correctly. > > This is you

Re: [R] S4 Class to Array

2015-12-16 Thread David Winsemius
> On Dec 16, 2015, at 7:45 AM, Glenn Schultz wrote: > > Hello All, > > I would like to be able to convert and S4 class to an array but I seem to be > stuck. Reading the documentation I think I need to use setAs() and then as() > Below is a minimal example but I cannot get it to work. So I a

[R] S4 Class to Array

2015-12-16 Thread Glenn Schultz
Hello All, I would like to be able to convert and S4 class to an array but I seem to be stuck.  Reading the documentation I think I need to use setAs() and then as()  Below is a minimal example but I cannot get it to work.  So I am doing something wrong but I don't know what it is. Any insight

Re: [R] Graphing the Area of Definite Integral

2015-12-16 Thread Steven Stoline
Dear William: *Left and Right Riemann Sums* Is there is a way to modify your function to compute Left Riemann Sum and Right Riemann Sum. I tried to modify yours, but i was not be able to make it work correctly. This is your function used to compute the Middle Riemann Sum. showIntegral.med <-

Re: [R] TIBCO Enterprise Runtime for R

2015-12-16 Thread William Dunlap via R-help
You can use capture.output(xmlParseOutput) to make a character vector with one string per line of printed R output and send that back to Spotfire for display. You will need to consult with Spotfire experts (at TIBCO support or community.tibco.com) to figure out the best way to display this in Spot

Re: [R] Graphing the Area of Definite Integral

2015-12-16 Thread William Dunlap via R-help
showIntegral <- function (f, xmin, xmax, n = 16, fractionFromLeft = 0.5) { stopifnot(fractionFromLeft >= 0, fractionFromLeft <= 1, n >= 1) curve(f(x), from = xmin, to = xmax, lwd = 2, col = "blue") abline(h = 0) dx <- (xmax - xmin)/n right <- xmin + (1:n) * dx left <

Re: [R] TIBCO Enterprise Runtime for R

2015-12-16 Thread Archit Soni
Thanks for the reply William, I wish to print the XML tree format in a text area. Can we do that by some way ? or is there a way to achieve that in IronPython, i am open for both options :) Thanks again for reply. On Wed, Dec 16, 2015 at 9:26 PM, William Dunlap wrote: > Your code works in TERR

Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-16 Thread Hadley Wickham
On Wed, Dec 16, 2015 at 9:34 AM, Hadley Wickham wrote: > On Tue, Dec 15, 2015 at 9:55 AM, Martin Maechler > wrote: >> >> >>[] >> >> > You are missing the closing bracket on the boxplot() >> > command. Just finish with a ')' >> >> Hmm... I once learned >> >> '()' =: paren

Re: [R] how to plot two variables in a figure using ggplot2

2015-12-16 Thread David L Carlson
You can also do this with matplot() which does not require reshaping the data. Assuming your data is a data frame called dat: > dput(dat) structure(list(XX = c(1243L, 2486L, 3729L, 4972L, 6215L, 7458L, 8701L, 9944L, 11187L), OA = c(0.8157, 0.819, 0.8278, 0.8354, 0.8475, 0.853, 0.8668, 0.879, 0.

Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-16 Thread Michael Dewey
As a speaker of the dialect of British English current in southern England I think: 1 - the generic term for all three is brackets. As a child I was taught the precedence rules for arithmetic operators by the mnemonic BODMAS (the O stands for 'of') 2 - careful speakers of the dialect who know

Re: [R] TIBCO Enterprise Runtime for R

2015-12-16 Thread William Dunlap via R-help
Your code works in TERR under Spotfire, but since Spotfire deals with rectangular data sets the glue code between them puts your objects in a data.frame, which is not legal. What do you hope to do with the XMLInteralDocument object in Spotfire? Such objects depend on R internal pointers and don't

Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-16 Thread Hadley Wickham
On Tue, Dec 15, 2015 at 9:55 AM, Martin Maechler wrote: > > >[] > > > You are missing the closing bracket on the boxplot() > > command. Just finish with a ')' > > Hmm... I once learned > > '()' =: parenthesis/es > '[]' =: bracket(s) > '{}' =: brace(s) > > Of course, I'm

Re: [R] how to plot two variables in a figure using ggplot2

2015-12-16 Thread John Kane
Please have a look at http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and/or http://adv-r.had.co.nz/Reproducibility.html for some general suggestions on posting here. In particular have a look at dput() or do a ?dput in R for the best way to supply sample da

Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-16 Thread John Kane
John Kane Kingston ON Canada > -Original Message- > From: s.elli...@lgcgroup.com > Sent: Tue, 15 Dec 2015 19:17:59 + > To: r-help@r-project.org > Subject: Re: [R] Make a box-whiskers plot in R with 5 variables, color > coded. > >> It is clear that a ) although is a type of bracket

Re: [R] Create a data.table by looping over variable names

2015-12-16 Thread András Tajti
Dear Matteo, I found a one-liner solution to this problem: n <- 100 data.table(i0 = 100)[, (paste0("i", 1:n)) := 100] the data.table(i0=100) creates a one column-one row data.table, Between the [] brakets i create a column name vector with paste, and surround it with () to make it recognised as n

[R] how to plot two variables in a figure using ggplot2

2015-12-16 Thread Gullen, James (MDE)
Greetings! You don't specify what type of "figure" you're looking for...here are two possibilities to get you started: As a note, it would have made things slightly easier if you had used dput() to provide the data to us. It took a little massaging in notepad before getting it into R. #Read d

Re: [R] Create a data.table by looping over variable names

2015-12-16 Thread David Käthner
Maybe there’s a cleverer way, but that’s what I can think off the top of my head: n <- 100 M.dt <- data.table(matrix(ncol = 100)) M.dt[] <- 100 names(M.dt) <- sapply(1:100, function(x) paste0("i", x)) The sapply is your loop. > Am 16.12.2015 um 12:53 schrieb Matteo Richiardi : > > I apologise

[R] NIPALS & categorical variables

2015-12-16 Thread Hana Mandová
Hello, Big help is needed. Can you use nipals for a dataset that contains both categorical as well as numerical variables? I used nipals instead of pca as some of my numerical variables contain missing values, but my categorical variables are complete. Many many thanks for your help, I've been

Re: [R] Create a data.table by looping over variable names

2015-12-16 Thread Matteo Richiardi
Hi, thanks a lot to everybody for your help. Very nice suggestions! Matteo On 16 December 2015 at 12:53, Matteo Richiardi wrote: > I apologise for this very basic question, but I found no answers on the > web. > I want to create a data.table with n columns, named i1 ... i'n', with only > one row

Re: [R] Create a data.table by looping over variable names

2015-12-16 Thread Giorgio Garziano
library(data.table) dat <- as.data.table(matrix(100, nrow=1, ncol=100)) colnames(dat) <- gsub("V", "i", colnames(dat)) -- GG [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://st

Re: [R] Create a data.table by looping over variable names

2015-12-16 Thread PIKAL Petr
Hi Not sure about data table but dat<-rep(100, 100) dim(dat) <- c(1,100) dat <- data.frame(dat) names(dat) <-paste("i", 1:100, sep="") gives you data.frame. I presume you can change it to data.table. I cannot resist to comment that maybe list is better option. But as I do not know what you wan

[R] Create a data.table by looping over variable names

2015-12-16 Thread Matteo Richiardi
I apologise for this very basic question, but I found no answers on the web. I want to create a data.table with n columns, named i1 ... i'n', with only one row with value = 100 for every variable. I can do it "by hand": M.dt <- data.table(i1=100,i2=100,i3=100) but I would like to make it in a lo

Re: [R] TIBCO Enterprise Runtime for R

2015-12-16 Thread Archit Soni
Yes William i'll see if i can get any help from TIBCommunity, but my code worked in RStudio. On Tue, Dec 15, 2015 at 4:41 PM, William Dunlap wrote: > It looks like you are calling TERR from Spotfire. The Spotfire/TERR > interface > can only pass TERR data.frames (eq. to Spotfire tables) back to