Re: [R] > Understanding strip.default & strip.custom

2016-06-27 Thread Duncan Mackay
Hi Patrick does this help? dat <- data.frame(x = rnorm(12*5,0,1), y = rnorm(12*5,0,1), gp = factor(1:12)) dat$NS = ifelse(sapply(dat$gp, pmatch,flN, nomatch = 0) > 0, "Needles","Stems") dat = dat[order(dat[,"NS"]),] dat$GP = factor(1:6) xyplot(y ~ x|gp, data

Re: [R] > Understanding strip.default & strip.custom

2016-06-27 Thread Bert Gunter
It's a vector of **length** 1, not **value** 1. In your case it gives the index (1 to 12) of the level being drawn in the panel, which is used to draw the strip according to other strip parameters, esp. style. You seem to be making this way more difficult than you should. strip.default is the **fu

[R] Turning a variable name into a function argument

2016-06-27 Thread KMNanus
I’m inexperience but am trying to get my head around using functions to make a number of ggplots easier to do. I have a function that creates a ggplot taking one input variable as an argument. The variable name is shorthand for the actual variable (variable name = tue, Actual name = Tuesday).

Re: [R] performance of do.call("rbind")

2016-06-27 Thread Jeff Newmiller
Sarah, you make it sound as though everyone should be using matrices, even though they have distinct disadvantages for many types of analysis. You are right that rbind on data frames is slow, but dplyr::bind_rows handles data frames almost as fast as your rbind-ing matrices solution. And if y

[R] > Understanding strip.default & strip.custom

2016-06-27 Thread p_connolly
I'm having difficulty following the help for those functions. My plot has a single conditioning factor with 12 levels. My factor.levels in a call to strip.default looks like this: factor.levels = expression(Needles~ "::"~alpha -pinene, Stems~ "::"~alpha -pinene,

Re: [R] What's box() (exactly) doing?

2016-06-27 Thread Marius Hofert
On Mon, Jun 27, 2016 at 5:42 PM, Greg Snow <538...@gmail.com> wrote: > You can use the grconvertX and grconvertY functions to find the > coordinates (in user coordinates to pass to rect) of the figure region > (or other regions). > > Probably something like: > grconvertX(c(0,1), from='nfc', to='use

[R] Call subroutine init_random_seed () in R

2016-06-27 Thread Kodalore Vijayan, Vineetha W
I want to call the subroutine init_random_seed() in R. The subroutine is defined as an example in the following link. https://gcc.gnu.org/onlinedocs/gfortran/RANDOM_005fSEED.html subroutine init_random_seed() use iso_fortran_env, only: int64 implicit none integer, allocata

Re: [R] What's box() (exactly) doing?

2016-06-27 Thread Greg Snow
You can use the grconvertX and grconvertY functions to find the coordinates (in user coordinates to pass to rect) of the figure region (or other regions). Probably something like: grconvertX(c(0,1), from='nfc', to='user') grconvertY(c(0,1), from='nfc', to='user') On Fri, Jun 24, 2016 at 8:19 P

Re: [R] performance of do.call("rbind")

2016-06-27 Thread Hervé Pagès
Hi, Note that if your list of 200k data frames is the result of splitting a big data frame, then trying to rbind the result of the split is equivalent to reordering the orginal big data frame. More precisely, do.call(rbind, unname(split(df, f))) is equivalent to df[order(f), , drop=FALSE]

Re: [R] performance of do.call("rbind")

2016-06-27 Thread Sarah Goslee
That's not what I said, though, and it's not necessarily true. Growing an object within a loop _is_ a slow process, but that's not the problem here. The problem is using data frames instead of matrices. The need to manage column classes is very costly. Converting to matrices will almost always be e

Re: [R] performance of do.call("rbind")

2016-06-27 Thread Marc Schwartz
Hi, Just to add my tuppence, which might not even be worth that these days... I found the following blog post from 2013, which is likely dated to some extent, but provided some benchmarks for a few methods: http://rcrastinate.blogspot.com/2013/05/the-rbinding-race-for-vs-docall-vs.html Ther

Re: [R] performance of do.call("rbind")

2016-06-27 Thread Jeff Newmiller
Your description of the data frames as "approx" puts the solution to considerable difficulty and speed penalty. If you want better performance you need a better handle on the data you are working with. For example, if you knew that every data frame had exactly three columns named identically a

Re: [R] performance of do.call("rbind")

2016-06-27 Thread Witold E Wolski
Hi Bert, You are most likely right. I just thought that do.call("rbind", is somehow more clever and allocates the memory up front. My error. After more searching I did find rbind.fill from plyr which seems to do the job (it computes the size of the result data.frame and allocates it first). best

Re: [R] performance of do.call("rbind")

2016-06-27 Thread Sarah Goslee
There is a substantial overhead in rbind.dataframe() because of the need to check the column types. Converting to matrix makes a huge difference in speed, but be careful of type coercion. testdf <- data.frame(matrix(runif(300), nrow=100, ncol=3)) testdf.list <- lapply(1:1, function(x)testdf)

Re: [R] performance of do.call("rbind")

2016-06-27 Thread Bert Gunter
The following might be nonsense, as I have no understanding of R internals; but "Growing" structures in R by iteratively adding new pieces is often warned to be inefficient when the number of iterations is large, and your rbind() invocation might fall under this rubric. If so, you might try

[R] refclasses question - Defining accessor function

2016-06-27 Thread Witold E Wolski
Are accessors a fancy feature that do not work? I wanted to use accessor functions in a R refclass to hide the classes implementation where I am using sqlite. What I did observe is, that if I access in a method any of the fields (in the example below field .data in method printExample) all the ac

[R] performance of do.call("rbind")

2016-06-27 Thread Witold E Wolski
I have a list (variable name data.list) with approx 200k data.frames with dim(data.frame) approx 100x3. a call data <-do.call("rbind", data.list) does not complete - run time is prohibitive (I killed the rsession after 5 minutes). I would think that merging data.frame's is a common operation. I

Re: [R] API key at start-up

2016-06-27 Thread Jeff Newmiller
"Assign ... key to a value" defies my understanding of those terms, and includes no context (API is a very vague term). We are not (necessarily) subject area experts in your preferred domain of jargon. Doing things when you start up your session is typically done as described in ?Startup -- S

Re: [R] Fwd: Fwd: RE: Heatmap.2 Breaks argument

2016-06-27 Thread Jeff Newmiller
Please use Reply-All to keep the mailing list included in the conversation. I don't do private consulting via the Internet, and others can correct me if I give bad advice. I doubt the maintaner function "doesn't work"... more likely you did not read the help file to learn how to use it: ?main

[R] API key at start-up

2016-06-27 Thread Glenn Schultz
All, Is there a way to assign an API key to a value FREDAPI which is loaded and available once a R session is has started? Glenn __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Antwort: RE: Antwort: Fw: Re: Subscripting problem with is.na()

2016-06-27 Thread PIKAL Petr
Hi On top of what Duncan wrote you can check results yourself > str(iris[,"Sepal.Length"]) num [1:150] 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... here you get vector and data.frame class is lost. The result is same as > str(iris$Sepal.Length) num [1:150] 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... How

Re: [R] object 'add.expr' not found

2016-06-27 Thread Duncan Murdoch
On 27/06/2016 3:52 AM, Christian Hoffmann wrote: Since the change to R-3.2.1 I seem to be unable to compile and install my package cwhmisc. One evidence is the appearance of th messages in R CMD build and install: * installing *source* package 'cwhmisc' ... ** R ** inst ** preparing package for

[R] object 'add.expr' not found

2016-06-27 Thread Christian Hoffmann
Since the change to R-3.2.1 I seem to be unable to compile and install my package cwhmisc. One evidence is the appearance of th messages in R CMD build and install: * installing *source* package 'cwhmisc' ... ** R ** inst ** preparing package for lazy loading Error in eval(expr, envir, enclos)

[R] Antwort: RE: Antwort: Fw: Re: Subscripting problem with is.na()

2016-06-27 Thread G . Maubach
Hi All, Petr, Bert, David, Ivan, Duncan and Rui helped me to develop a function able to replace NA's in variables IF NEEDED: #--- # Module: t_replace_na.R # Author: Georg Maubach # Date : 2016-06

Re: [R] Antwort: RE: Antwort: Fw: Re: Subscripting problem with is.na()

2016-06-27 Thread Duncan Murdoch
On 27/06/2016 7:43 AM, g.maub...@weinwolf.de wrote: Hi Petr, many thanks for your reply and the examples. My subscripting problems drive me nuts. I have understood that dataset[variable] is semantically identical to dataset[, variable] cause dataset[variable] takes all cases because no other s

[R] Antwort: RE: Antwort: Fw: Re: Subscripting problem with is.na()

2016-06-27 Thread G . Maubach
Hi Petr, many thanks for your reply and the examples. My subscripting problems drive me nuts. I have understood that dataset[variable] is semantically identical to dataset[, variable] cause dataset[variable] takes all cases because no other subscripts are given. Where can I lookup the rules w

Re: [R] Antwort: Fw: Re: Subscripting problem with is.na()

2016-06-27 Thread PIKAL Petr
Hi see in line > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of > g.maub...@weinwolf.de > Sent: Monday, June 27, 2016 10:45 AM > To: David L Carlson ; Bert Gunter > > Cc: r-help@r-project.org > Subject: [R] Antwort: Fw: Re: Subscripting problem with

[R] Antwort: Fw: Re: Subscripting problem with is.na()

2016-06-27 Thread G . Maubach
Hi David, Hi Bert, many thanks for the valuable discussion on NA in R (please see extract below). I follow your arguments leaving NA as they are for most of the time. In special occasions however I want to replace the NA with another value. To preserve the newly acquired knowledge for me I wrot

Re: [R] Right input mechanism to R for high amount of data

2016-06-27 Thread PIKAL Petr
Hi have you read something of these? http://www.r-bloggers.com/five-ways-to-handle-big-data-in-r/ https://en.wikipedia.org/wiki/Programming_with_Big_Data_in_R http://r-pbd.org/ http://www.columbia.edu/~sjm2186/EPIC_R/EPIC_R_BigData.pdf I am not an expert in big data, however when reading your da