Re: [R] R-memory: clearing memory within a function?

2014-06-03 Thread Prof Brian Ripley
On 04/06/2014 01:35, Ista Zahn wrote: Hi Frank, I don't think it is possible to state a general rule about which will be faster. For example this system.time({ for(i in 1:1) { x <- matrix(rnorm(10), ncol = 10) y <- mean(x) #rm(x) z <- matrix(runif(10

[R] Extraction of forecats from VAR prediction

2014-06-03 Thread Jonas Ulbrich
Hi, my question is the following one: predict(VAR(y,p=1,type="none"),n.ahead=500) How can I extract the forecasts of this prediction? y is a dataset of four parameters with 500 values each.One parameter for instance is lambda the head looks like this: $lambda fcst lower

Re: [R] as.character.call?

2014-06-03 Thread Spencer Graves
Hi, Henrik: Thanks. I should probably know that by now ... but it didn't come to mind just now. Thanks again. Spencer. On 6/3/2014 8:13 PM, Henrik Bengtsson wrote: cl <- quote(round(10.5)) deparse(cl) [1] "round(10.5)" /Henrik On Tue, Jun 3, 2014 at 8:07 PM, Spencer Graves wrote:

Re: [R] as.character.call?

2014-06-03 Thread Henrik Bengtsson
> cl <- quote(round(10.5)) > deparse(cl) [1] "round(10.5)" /Henrik On Tue, Jun 3, 2014 at 8:07 PM, Spencer Graves wrote: > How can I get a call object as a character string? > > > Example: > >> cl <- quote(round(10.5)) >> str(cl) > language round(10.5) >> as.character(cl) > [1] "round" "1

[R] as.character.call?

2014-06-03 Thread Spencer Graves
How can I get a call object as a character string? Example: > cl <- quote(round(10.5)) > str(cl) language round(10.5) > as.character(cl) [1] "round" "10.5" How can I get "round(10.5)"? I can get this answer for this toy problem with paste0(paste(as.character(cl), collap

Re: [R] Plotting issues with -par(mfrow=c(r,c))- after -boot-

2014-06-03 Thread Jeff Newmiller
No, because I have never used Boot, or tried to use plot.boot... I just know that there are three main styles of plotting in R and the manual pages are usually informative on which is in use. I am glad you figured out a better solution though, and thanks for reporting back. -

Re: [R] Plotting issues with -par(mfrow=c(r,c))- after -boot-

2014-06-03 Thread Clive Nicholas
On 1 June 2014 22:07, Jeff Newmiller wrote: Read ?plot.boot, in particular the Side Effects section. Not a very > friendly function... you will have to modify it if you wish to proceed. > I guess you were expecting me to come back at some stage to say that I'd figured out the -Boot- package of r

Re: [R] R-memory: clearing memory within a function?

2014-06-03 Thread Henrik Bengtsson
See blog post 'Speed trick: Assigning large object NULL is much faster than using rm()!': http://www.jottr.org/2013/05/speed-trick-assigning-large-object-null.html /Henrik On Tue, Jun 3, 2014 at 5:35 PM, Ista Zahn wrote: > Hi Frank, > > I don't think it is possible to state a general rule abo

Re: [R] detect escape character

2014-06-03 Thread David Winsemius
On Jun 3, 2014, at 11:03 AM, Adrian Dușa wrote: > Dear All, > > I should be knowing this, but not get it right... I'm a little surprised to see you ask this, too, but we each have lacunae in our R knowledge, so I hope this helps: > s <- scan(what="") # Assuming you were asking about items co

Re: [R] R-memory: clearing memory within a function?

2014-06-03 Thread Ista Zahn
Hi Frank, I don't think it is possible to state a general rule about which will be faster. For example this system.time({ for(i in 1:1) { x <- matrix(rnorm(10), ncol = 10) y <- mean(x) #rm(x) z <- matrix(runif(10), ncol = 100) #rm(z) } }) gets

Re: [R] tab auto-fill and arrow keys are not working in R on a linux cluster

2014-06-03 Thread Jeff Newmiller
FAQ 7.20 --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engine

[R] tab auto-fill and arrow keys are not working in R on a linux cluster

2014-06-03 Thread Shi, Tao
Hi List, We have R 3.1.0 installed on the head node of our linux cluster, but the tab auto-complete and the arrow keys are not working.  When I was trying to use the up/down arrow key to scroll through the old command history I got something like this.  Any ideas on what's going on here? Many

Re: [R] Code for generating states and observations for HMM

2014-06-03 Thread Rolf Turner
You might find it helpful to look at the sim.hmm() function in the "hmm.discnp" package, or the simHMM() function in the "HMM" package. cheers, Rolf Turner On 03/06/14 21:17, Bukar Alhaji wrote: Dear R buddies, Sorry for this silly question but am new to R. I am trying to generate states a

[R] Multiplicative Heterogeneous DIFFusion (mhdiff) models in R

2014-06-03 Thread Iuri Gavronski
Hi, I am looking for a port of the SAS mhdiff macro ( http://www.soc.cornell.edu/faculty/strang/mhdiff/mhdiff_b.sas) to R, to estimate multiplicative heterogeneous diffusion models (see http://www.soc.cornell.edu/faculty/strang/mhdiff/mhdiff_b.pdf or http://www.jstor.org/stable/2781285) Thanks in

Re: [R] plot in package psych with function error.bars.by

2014-06-03 Thread Jim Lemon
On Mon, 2 Jun 2014 11:28:19 PM Tham Tran wrote: > Hi, > > I have a problem with the function "error.bars.by" in package "psych". > This is the code for example of a graph: > > keys.list=list(Agree=c(-1,2:5),Conscientious=c(6:8,-9,-10),Extraversion=c(-1 > 1,-12,13:15),Neuroticism=c(16:20),Openne

Re: [R] Star schema

2014-06-03 Thread Sarah Goslee
On Tue, Jun 3, 2014 at 2:31 PM, kyle polich wrote: > Are there any libraries for R that would enable the import of data stored > in star schema? As I understand it star schema is an organizational concept, not a file format. How are the data actually stored? In a RDBMS? As csv files? What are you

Re: [R] ICL for betamix()

2014-06-03 Thread ChrisR
I found a way to manually calculate the ICL for a betamix() result, using the entropy.empirical() command from the 'entropy' package. Here is the code: model=betamix(y~x) BIC(model)+entropy.empirical(posterior(model)) Cheers, Chris -- View this message in context: http://r.789695.n4.nabble.co

[R] Star schema

2014-06-03 Thread kyle polich
Are there any libraries for R that would enable the import of data stored in star schema? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide htt

Re: [R] detect escape character

2014-06-03 Thread Jeff Newmiller
With the right mental model, though, it can become intuitive. That is, keep in mind that the R interpreter uses \ as a metacharacter, and so does the regex library. You want to search for a \, which regex thinks is special, so you have to escape it for regex functions (\\). Then, because R think

Re: [R] detect escape character

2014-06-03 Thread Sarah Goslee
On Tue, Jun 3, 2014 at 2:29 PM, Frede Aakmann Tøgersen wrote: > Hmmmmm. > >> mystring <- "Man\\Woman" >> cat(mystring) > Man\Woman> >> >> mystring <- "Man\Woman" > Fejl: '\W' is an unrecognized escape in character string starting ""Man\W" Right. As the comment in my code indicated, \ is a

Re: [R] detect escape character

2014-06-03 Thread Frede Aakmann Tøgersen
Hmmmmm. > mystring <- "Man\\Woman" > cat(mystring) Man\Woman> > > mystring <- "Man\Woman" Fejl: '\W' is an unrecognized escape in character string starting ""Man\W" > So was the OP asking about? We need some more information, thank you!. Yours sincerely / Med venlig hilsen Frede Aa

Re: [R] detect escape character

2014-06-03 Thread Sarah Goslee
Hi, R uses \ as a metacharacter, so you need a non-intuitive number of \: mystring <- "Man\\Woman" # \\ is a metacharacter and a \, so it's equivalent to \ in normal text sub("", "/", mystring) Sarah On Tue, Jun 3, 2014 at 2:03 PM, Adrian Dușa wrote: > Dear All, > > I should be knowing

[R] detect escape character

2014-06-03 Thread Adrian Dușa
Dear All, I should be knowing this, but not get it right... For a string like this: "Man\Woman" I would like to detect the escape character "\" and replace it with "/". Tried various ways using gsub(), but don't get it right yet. Any suggestion would be highly welcomed... Thank you, Adrian --

Re: [R] tkbind (callback)

2014-06-03 Thread Greg Snow
I think the problem is that the tkbind function is expecting the 3rd argument to be a function and the arguments of functions passed to tkbind need to have specific names. In your call when you do the binding the OtoFanCallback function is called at that time (hence the initial print) and its retu

Re: [R] Prediction interval with GAM?

2014-06-03 Thread Zofia Ecaterina Taranu
I apologize in advance for my very basic question. I would like to plot prediction intervals for my GAM model, however, instead of using a Gamma GAM, I assumed a Gaussian distribution (I standardized my response variable, which resulted in negative values). To create the prediction interval for

[R] Yield Curve Package Svensson

2014-06-03 Thread Jonas Ulbrich
Hi, thank you for your rapid answer. The problem is solved. My second and last question is as follows: I use the yield curve package and I want to calculate the fitted yields via the Svensson approach. The I have already calculated the six required parameters. At first I read them in from a

Re: [R] Time Series

2014-06-03 Thread arun
Hi Wayne, As John mentioned, it is not clear about your expectations.  May be this helps: library(xts) x2New <- xts(test[,-1], order.by=test[,1]) library(xtsExtra) plot(x2New,screens=1,auto.legend=TRUE) A.K. On Tuesday, June 3, 2014 9:29 AM, John Kane wrote: I know essentially nothing abou

[R] R-memory: clearing memory within a function?

2014-06-03 Thread Frank van Berkum
Dear R-users, I'm working on a project in which many simulations have to be performed within functions. The simulations are quite time consuming. I thought that in general an empty memory is better for speed performance than a full memory. If I call a function which performs simulations within

[R] Online, automatic evaluation of class assessment R scripts

2014-06-03 Thread Werner W.
Dear R group, I will be giving a course on R in a bit of time. I am very intrigued by the way R coding assessments are done in several courses on Coursera and would like to figure out whether I am capable of setting up such a system for my course. On Coursera, R scripts are submitted online and th

Re: [R] Time Series

2014-06-03 Thread Duncan Mackay
Not sure where things are up to in the thread but this may illuminate things Using the test data.frame from an old thread I was just looking at https://stat.ethz.ch/pipermail/r-help/2007-May/133033.html ylabGrob <- function(...) { # ...is lab1, lab2, etc labs <- lapply(list(...), textGrob, rot = 9

Re: [R] Question about setdiff()

2014-06-03 Thread Σταῦρος Μακράκης
There are two kinds of set difference: the usual set difference , also called the asymmetric difference or relative complement, and the symmetric difference . In R, setdiff(a,b) is

[R] control for repeated observations in a simple correlation design

2014-06-03 Thread Caroline Lustenberger
Dear all I want to correlate 2 variables (EEG and Motorperformance) for 18 observations. However, these variables consist of only 6 subjects that were measured 3 times (leading to 18 observations). How can I calculate the correlation coefficient and p-value and control for this "repeated obs

[R] control for repeated observations in a simple correlation design

2014-06-03 Thread Caroline Lustenberger
Dear all I want to correlate 2 variables (EEG and Motorperformance) for 18 observations. However, these variables consist of only 6 subjects that were measured 3 times (leading to 18 observations). How can I calculate the correlation coefficient and p-value and control for this "repeated obs

Re: [R] Time Series

2014-06-03 Thread Bastian Pöschl
It would be great to get a detailed question. As far as I understood you wanted to plot your series in a single frame. There are plenty examples in the help of plot.ts and plot.zoo for that. I prefer working with time series be using the zoo package. But most things can also be done within ts. The

Re: [R] Time Series

2014-06-03 Thread John Kane
I know essentially nothing about plotting time series so so I just let it pass hoping someone with knowledge of time series would help What were you expecting to get? Just plotting the time series without labels etc, since I am getting some weird error messages about pch having a “unexpected ',

[R] Code for generating states and observations for HMM

2014-06-03 Thread Bukar Alhaji
Dear R buddies, Sorry for this silly question but am new to R. I am trying to generate states and observations to be use for Bayesian Hidden Markov Models analysis where i intend using mixture of Poisson and Negative binomial as emulsion. I use the code below to generate states and observation

[R] tkbind (callback)

2014-06-03 Thread Fowler, Mark
Hello, I've migrated an ADMB application with a user dialog from S to R. The script below will produce a dialog in R, and don't need data to address this issue. It works in terms of capturing user inputs to pass along, no problem running the ADMB program. However some of the options have depend

[R] plot in package psych with function error.bars.by

2014-06-03 Thread Tham Tran
Hi, I have a problem with the function "error.bars.by" in package "psych". This is the code for example of a graph: keys.list=list(Agree=c(-1,2:5),Conscientious=c(6:8,-9,-10),Extraversion=c(-11,-12,13:15),Neuroticism=c(16:20),Openness = c(21,-22,23,24,-25)) keys = make.keys(28,keys.list,item.lab

Re: [R] Descriptive Stat

2014-06-03 Thread arun
HI Farnoosh, May be this helps: set.seed(497) dat <- data.frame(Unit=sample(10, 200,replace=TRUE), MD= sample(5,200,replace=TRUE), Response=sample(3, 200, replace=TRUE)) library(reshape2) res <- dcast(dat, Unit+MD~Response, value.var="Response", length)  res[,-(1:2)] <- round((res[,-(1:2)]/rowSu

[R] Change the raster data extent

2014-06-03 Thread Alexsandro Cândido de Oliveira Silva
Hi, I’m trying to check if several raster data stored in temp.data have the same extent of target raster. I guarantee that all data in temp.data overlap the target and they have the same resolution and crs. The conditional test is ok, because the “OK! ” is printed. But the algorithm return: Err

Re: [R] HAC standard errors

2014-06-03 Thread Achim Zeileis
On Mon, 2 Jun 2014, Nick Pretnar wrote: Hello, I am having a great amount of difficulty running a simple linear regression model with entity and time fixed effects and HAC standard errors. I have a data set with 3 million observations and 30 variables. My data is structured as follows: NAME

[R] ECCB 2014

2014-06-03 Thread Wolfgang Raffelsberger
We are pleased to invite you to the 13th European Conference on Computational Biology ! ECCB 2014 will take place in Strasbourg, France, september 7 - 10. Website : http://www.eccb14.org Area topics : A. Sequencing and sequence analysis for genomics B. Gene expression C: Pathways and molecular n