[R] subsetting ls() as per class...

2018-07-27 Thread akshay kulkarni
dear memebers, I am using R in AWS linux instance for my research. I want to remove certain objects from the global environment to reduce my EBS cost..for example, I want to remove all objects of class "xts", "zoo". Is there any way to automate this, instead of

Re: [R] Grouped boxplots using ggplot() from ggplot2.

2018-07-27 Thread Jeff Newmiller
When you understand the strong dependence on how the data controls ggplot, using it gets much easier. I still have to google details sometimes though. Note that it can be very difficult to make a weird plot (e.g. multiple parallel axes) in ggplot because it is very internally consistent... a

[R] Grouped boxplots using ggplot() from ggplot2.

2018-07-27 Thread Rolf Turner
I have the task of producing some boxplot graphics with the requirement that these have the same general appearance as a set of such graphics as were produced last year. I do not have access to the code that was used to produce the "last year" graphics. There are multiple boxplots per figure

Re: [R] Formatting summary() output to a file

2018-07-27 Thread MacQueen, Don via R-help
Hmmm. I do get output in the file with the first example, and the second example is too complicated for me. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 Lab cell 925-724-7509 On 7/27/18, 9:56 AM, "R-help on behalf of

Re: [R] RStudio 1.1.453 - Windows 10 - How to see detailed results of every calculation step

2018-07-27 Thread Rui Barradas
Hello, First of all welcome to R, I hope you enjoy it and that as you go along it will give less and less troubles. Now, why would length(56) return 2? It's just one number, a vector of length 1. Start by trying it at an R prompt and see the result. Hope this helps, Rui Barradas Às

Re: [R] RStudio 1.1.453 - Windows 10 - How to see detailed results of every calculation step

2018-07-27 Thread إبراهيم خطاب Ibrauheem Khat'taub
OMG, Jeff, this is so helpful of you! Thanks a lot! On Fri, 27 Jul 2018 at 12:32, Jeff Newmiller wrote: > Debugging in R applies one statement at a time. If you want to debug > within a statement you can "step into" the function calls within the > statement or you can execute the function

Re: [R] RStudio 1.1.453 - Windows 10 - How to see detailed results of every calculation step

2018-07-27 Thread إبراهيم خطاب Ibrauheem Khat'taub
Thanks a lot, Michael! On Fri, 27 Jul 2018 at 12:12, Michael Dewey wrote: > Dear Ibrauheem > > First try > > length(56) > > then try > rnorm() > using the value you got in stage 1 > > Michael > > On 27/07/2018 16:07, إبراهيم خطاب Ibrauheem Khat'taub wrote: > > Hi everyone, > > > > I am

Re: [R] RStudio 1.1.453 - Windows 10 - How to see detailed results of every calculation step

2018-07-27 Thread إبراهيم خطاب Ibrauheem Khat'taub
Thanks a lot, Sarah! Appreciate the help! On Fri, 27 Jul 2018 at 12:55, Sarah Goslee wrote: > You can readily do it yourself: > > x <- 56 > length(x) # hint: why do you expect length(56) to be 2? > rnorm(length(x)) > x + rnorm(length(x)) > > For more complicated problems, the debugger is

Re: [R] RStudio 1.1.453 - Windows 10 - How to see detailed results of every calculation step

2018-07-27 Thread إبراهيم خطاب Ibrauheem Khat'taub
Thanks a lot, Rui! On Fri, 27 Jul 2018 at 12:02, Rui Barradas wrote: > Hello, > > First of all welcome to R, I hope you enjoy it and that as you go along > it will give less and less troubles. > > Now, why would length(56) return 2? It's just one number, a vector of > length 1. > > Start by

Re: [R] Formatting summary() output to a file

2018-07-27 Thread Rich Shepard
On Fri, 27 Jul 2018, William Dunlap wrote: I often use capture.output to slightly reformat printout output. E.g, to indent str's output to make it easier to read debugging printouts: debug_print <- function(x, name=substitute(x), indent=4) { cat(sep="\n", name, paste0(strrep(" ", indent),

Re: [R] Formatting summary() output to a file

2018-07-27 Thread William Dunlap via R-help
I often use capture.output to slightly reformat printout output. E.g, to indent str's output to make it easier to read debugging printouts: debug_print <- function(x, name=substitute(x), indent=4) { cat(sep="\n", name, paste0(strrep(" ", indent), capture.output(str(x } Used as in > myData

Re: [R] Formatting summary() output to a file

2018-07-27 Thread Rich Shepard
On Fri, 27 Jul 2018, MacQueen, Don wrote: Given your description, I would start with sink('wysumallyrs.txt') print( summary(wyallyrs) ) sink() and see if that doesn't meet your needs. Don, I started with sink() trying to follow

Re: [R] RStudio 1.1.453 - Windows 10 - How to see detailed results of every calculation step

2018-07-27 Thread Sarah Goslee
You can readily do it yourself: x <- 56 length(x) # hint: why do you expect length(56) to be 2? rnorm(length(x)) x + rnorm(length(x)) For more complicated problems, the debugger is useful, but I almost always find investigating the steps at the command line to be the most informative. Sarah On

Re: [R] Formatting summary() output to a file

2018-07-27 Thread MacQueen, Don via R-help
Given your description, I would start with sink('wysumallyrs.txt') print( summary(wyallyrs) ) sink() and see if that doesn't meet your needs. Some of the basic principles: (1) Whenever you type the name of an R object at the R prompt, it is as if R wraps whatever you typed inside print().

Re: [R] RStudio 1.1.453 - Windows 10 - How to see detailed results of every calculation step

2018-07-27 Thread Jeff Newmiller
Debugging in R applies one statement at a time. If you want to debug within a statement you can "step into" the function calls within the statement or you can execute the function calls separately and inspect the result. Your function consists of one statement so the debugger only has one place

Re: [R] RStudio 1.1.453 - Windows 10 - How to see detailed results of every calculation step

2018-07-27 Thread Michael Dewey
Dear Ibrauheem First try length(56) then try rnorm() using the value you got in stage 1 Michael On 27/07/2018 16:07, إبراهيم خطاب Ibrauheem Khat'taub wrote: Hi everyone, I am taking my first R course. This was my first example. When I executed: AddLengthNoise <- function(x) {x +

Re: [R] Formatting summary() output to a file

2018-07-27 Thread Rich Shepard
On Fri, 27 Jul 2018, Bert Gunter wrote: print.summaryDefault ## at the prompt. It's in base R, so no package:: prefix needed will give you the code used for formatting. You can then do the same. Bert, Thank you. Rich __ R-help@r-project.org

Re: [R] Formatting summary() output to a file

2018-07-27 Thread Bert Gunter
Not quite sure what you mean here. R is open source, so > print.summaryDefault ## at the prompt. It's in base R, so no package:: prefix needed will give you the code used for formatting. You can then do the same. Cheers, Bert Bert Gunter "The trouble with having an open mind is that

Re: [R] Formatting summary() output to a file

2018-07-27 Thread William Dunlap via R-help
Try cat(sep="\n", file=con, capture.output(summary(...))) capture.output(x) return character vector whose elements contain the lines of text that would have been printed by print(x). Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Jul 27, 2018 at 8:20 AM, Rich Shepard wrote: > I want

Re: [R] Formatting summary() output to a file

2018-07-27 Thread Rich Shepard
On Fri, 27 Jul 2018, William Dunlap wrote: Try cat(sep="\n", file=con, capture.output(summary(...))) capture.output(x) return character vector whose elements contain the lines of text that would have been printed by print(x). Bill, Thanks very much. I doubt my searches would have found

[R] RStudio 1.1.453 - Windows 10 - How to see detailed results of every calculation step

2018-07-27 Thread إبراهيم خطاب Ibrauheem Khat'taub
Hi everyone, I am taking my first R course. This was my first example. When I executed: AddLengthNoise <- function(x) {x + rnorm(length(x))} using 56 as the value of x, I expected the result to be two values, something like: [1] 56.17491697 56.02935105 because I expected rnorm to return two

[R] Formatting summary() output to a file

2018-07-27 Thread Rich Shepard
I want to save the output of summary(df_name) to a disk file and my research found that the sink() function is what I want to use. The 'R Cookbook' provides a an alternative example using cat() to a connection. Here, con <- file("wysumallyrs.txt", "w") cat(summary(wyallyrs), file=con)

Re: [R] Plot Rect Transparency

2018-07-27 Thread Martin Maechler
> Duncan Murdoch > on Thu, 28 Jun 2018 20:57:19 -0400 writes: > On 28/06/2018 5:29 PM, Jeff Reichman wrote: >> R-Help >> >> >> >> Is there a way to make a rectangle transparent (alpha=0.1??) >> >> >> >> plot(c(100, 200), c(300, 450),

Re: [R] how to locate specific line?

2018-07-27 Thread William Dunlap via R-help
If Sys.which("grep") says that grep is available then system("grep -n ...") will do it. > cat(c("One","Two","Three","Four"),sep="\n",file=tf<-tempfile()) > system(paste("grep --line-number", shQuote("^T"), shQuote(tf)), intern=TRUE) [1] "2:Two" "3:Three" > as.integer(sub(":.*$", "",

Re: [R] ESS issue: lines moved right 40 spaces

2018-07-27 Thread Rich Shepard
On Fri, 27 Jul 2018, Eric Berger wrote: I also use emacs with ESS for editing R files and I have been living with the comment indentation problem you described. Based on the comments in this thread I did a search and found a posted solution that works for me. See

Re: [R] Using apply function to merge list of data frames

2018-07-27 Thread Jeff Newmiller
Er, rbind is not merge... do.call expects the function you specify to handle all the elements of the list in a single invocation... Reduce will work with a two-argument function. Reduce(merge, df.list, accumulate=TRUE, by='date') For clarity: apply and the like have for loops inside them, so

Re: [R] Breaking the samplesize package from CRAN

2018-07-27 Thread john matthew via R-help
Dear Bert, Thanks for your answer, I already wrote to the maintainer/author of samplesize, Ralph Scherer, on Thu, Apr 19, 2018 but still have no answer. Does anyone have any ideas? Thank you. John. On 26 July 2018 at 20:18, Bert Gunter wrote: > Suggest you contact the package maintainer. > >

Re: [R] Using apply function to merge list of data frames

2018-07-27 Thread S Ellison
Short answer: do.call() do.call("rbind", df.list) will rbind all of the data frames in df.list. You may have to tidy up row names afterwards, and you will need to make sure that the data frames all have the same column names and each column has the same class, or you'll get unexpected results.

Re: [R-es] Ayuda ggplot

2018-07-27 Thread Carlos Ortega
Hola, Aquí dan detalles de cómo hacerlo. https://stackoverflow.com/questions/4332274/how-can-a-line-be-overlaid-on-a-bar-plot-using-ggplot2 Saludos, Carlos Ortega www.qualityexcellence.es El 27 de julio de 2018, 13:13, Jaume Tormo escribió: > Yo hice una vea un gráfico parecido, sin ggplot,

[R-es] Ayuda ggplot

2018-07-27 Thread Jaume Tormo
Yo hice una vea un gráfico parecido, sin ggplot, el gráfico está aquí: https://acercad.wordpress.com/2009/05/05/acerca-de-otra-grafica-en-r/ Jaume. El lunes, 23 de julio de 2018, Dayana Muñoz escribió: > Estimad@s, > > Junto con saludar, quería saber si alguien me podría ayudar con este >

Re: [R] how to locate specific line?

2018-07-27 Thread Jeremie Juste
Hello, If you need to go through R the function fread of data.table can speed up the data import. If not and you work on a gnu/linux distro may be awk might help https://stackoverflow.com/questions/5536018/how-to-print-matched-regex-pattern-using-awk HTH, Jeremie

Re: [R] How to limit an isotonic step regression to exactly n steps?

2018-07-27 Thread PIKAL Petr
Hi Did you consider strucchange or segmented packages? They accept restriction on number of segments. Cheers Petr > -Original Message- > From: R-help On Behalf Of Tanush Jagdish > Sent: Friday, July 27, 2018 12:30 AM > To: r-help@r-project.org > Subject: [R] How to limit an isotonic

[R] How to limit an isotonic step regression to exactly n steps?

2018-07-27 Thread Tanush Jagdish
I am trying to fit an isotonic step function to my data. Every isotonic step regression function (I've tried isoreg, pava, etc) 'finds' multiple points of increase (steps) across my dataset. However, I would like to limit the steps to 7, because given my understanding of the data, I expect exactly

[R] how to locate specific line?

2018-07-27 Thread Jinsong Zhao
Hi there, I have a large/huge text file. I need to locate a line in the file with a specific string, for example, "Data Points". Now, I use the following code to do: df <- readLines(file) l <- grep("Data Points", df) However, in this case, the file will be read throughout into R. When the

Re: [R] ESS issue: lines moved right 40 spaces

2018-07-27 Thread Eric Berger
Hi Rich, Thanks for posting this question. I also use emacs with ESS for editing R files and I have been living with the comment indentation problem you described. Based on the comments in this thread I did a search and found a posted solution that works for me. See

Re: [R] Creatng new variable based upon conditions

2018-07-27 Thread PIKAL Petr
Hi Or maybe without ifelse xy$w <- with(xy, x * ((y != "A") + 2) * 5) Cheers Petr > -Original Message- > From: R-help On Behalf Of Dénes Tóth > Sent: Thursday, July 26, 2018 10:10 PM > To: JEFFERY REICHMAN ; r-help@r-project.org > Subject: Re: [R] Creatng new variable based upon