Re: [R] How to clear R memory in a for loop

2014-10-20 Thread Prof Brian Ripley
On 20/10/2014 17:53, John McKown wrote: On Mon, Oct 20, 2014 at 10:30 AM, Dimitri Liakhovitski < dimitri.liakhovit...@gmail.com> wrote: Dear Rers, I am trying to run a for-loop in R. During each iteration I read in an mp3 file and do some basic processing. If I do what I need to do for each fi

Re: [R] Ternary Plots Do Not Display Ellipses in PDF

2014-10-20 Thread Paul Murrell
Hi I think the problem is that, as David Carlson pointed out, ellipses() works by redrawing the plot and adding more to it. This means that your PDF version has *two pages*, one with the original plot, then another with the plot-plus-ellipses. Paul On 10/15/14 10:20, Rich Shepard wrote:

Re: [R] pasteFromExcel

2014-10-20 Thread David Winsemius
On Oct 20, 2014, at 2:34 PM, Dan Murphy wrote: > Good ideas, David. > > 1) By "confirm that MS Excel honors that OutDec" I mean that, in a > location (France? others?) where options("OutDec") is a comma, does MS > Excel format numbers that way when displaying currencies with decimal > places? I

Re: [R] pasteFromExcel

2014-10-20 Thread Dan Murphy
Good ideas, David. 1) By "confirm that MS Excel honors that OutDec" I mean that, in a location (France? others?) where options("OutDec") is a comma, does MS Excel format numbers that way when displaying currencies with decimal places? I have no way of knowing if that is true in all OutDec = "," lo

Re: [R] making a plot

2014-10-20 Thread Enrico Colosimo
Thanks David and Adrés, it worked fine. Enrico. 2014-10-20 15:37 GMT-02:00 David Winsemius : > > On Oct 20, 2014, at 8:24 AM, Andrés Aragón wrote: > > > Enrico, > > > > This may help you: > > > > text(locator(1), "*", cex=1.5,adj=0.5 > > > > and > > > > text(locator(1), "º", cex=1.5,adj=0.5 >

Re: [R] format negative numbers

2014-10-20 Thread David Winsemius
On Oct 20, 2014, at 4:32 AM, PIKAL Petr wrote: > Hi > > Thanks to all who responded. > > My input string is rather clumsy. Actually it can have leading or trailing > empty space too, it can be mixture of positive and negative numbers. > > In the meantime I made small function which just strip

Re: [R] distance from fitted line

2014-10-20 Thread eliza botto
Thankyou Turner, As i said It was out of my curiosity.Thankyou very much for your reply. :) Eliza > Date: Tue, 21 Oct 2014 08:40:39 +1300 > From: r.tur...@auckland.ac.nz > To: eliza_bo...@hotmail.com > CC: joachim.audena...@pcsierteelt.be; r-help@r-project.org > Subject: Re: [R] distance from fi

Re: [R] how to overwrite a Unary operator ?

2014-10-20 Thread Greg Snow
There is currently no way to write your own unary operator in R. The only current unary operators are prefix (-, +, !). It would take some major changes to the parser to recognize the syntax that you want (which could also break other things that already work well), and with the oo and other meth

Re: [R] distance from fitted line

2014-10-20 Thread Rolf Turner
On 20/10/14 23:00, eliza botto wrote: Thankyou very much Joachim. Actually I already know the residual() command. I only wanted to know that is there a way to account for the fitted lines? its more of a criosity rather than a problem. :) Thankyou very much once again. What (on earth!) do you

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread Dimitri Liakhovitski
Thank you, everybody. Bill - do I interpret your response correctly if I say: we should check if tuneR is handling .wav files better than mp3 files. On Mon, Oct 20, 2014 at 12:53 PM, William Dunlap wrote: > tuneR::readMP3 may not be allocating (or freeing) memory correctly. On both > Linux and W

[R] glmer with multiple random slopes

2014-10-20 Thread David Kikuchi
Hi all, I'm modeling the probability that a subject attacks or rejects a prey item based on its proportion of yellow coloration and size. There are two populations of prey, one defended and the other undefended, so subjects should reject one type and accept others. Each subject has a unique r

Re: [R] pasteFromExcel

2014-10-20 Thread David Winsemius
On Oct 20, 2014, at 10:29 AM, Dan Murphy wrote: > Nice. > So if someone were to offer a currency regular expression that works > in their locale, I should also ask them to give me the results of > Sys.getlocale("LC_MONETARY") > and > options("OutDec") > and confirm that MS Excel honors that OutDe

Re: [R] making a plot

2014-10-20 Thread David Winsemius
On Oct 20, 2014, at 8:24 AM, Andrés Aragón wrote: > Enrico, > > This may help you: > > text(locator(1), "*", cex=1.5,adj=0.5 > > and > > text(locator(1), "º", cex=1.5,adj=0.5 Why not just use the values of x2 and y2 that were given to segments: > text( (ano+ranges)[1:3], 1:3, "*", cex=1.5,

Re: [R] matching genes to a list of gene groups an built binary data frame

2014-10-20 Thread David Winsemius
On Oct 20, 2014, at 6:28 AM, Karim Mezhoud wrote: > Genes <- c("ACACA", "BAX" , "BCL2", "BID", "BAX", "MAPK9") > > and a list of group of genes > > ListGroup <- list(group1=c("ACACA" ,"AHSA1" ,"AIMP2", "AKR1B1", > "AKT1", "AKT1S1"), group2=c("ANXA1" , "AR" , "ARID1A" , > "

Re: [R] understanding the no-label concept

2014-10-20 Thread Ista Zahn
On Thu, Oct 16, 2014 at 3:19 PM, wrote: >> aa <- 1:5 >> names(aa) <- c("Eins", "Zwei", "Drei", "Vier", "Fünf") >> aa > Eins Zwei Drei Vier Fünf >12345 >> table(aa) > 1 2 3 4 5 > 1 1 1 1 1 > > You see? It didn't work. perhaps you want table(names(aa)) Or maybe just aa <- -

Re: [R] pasteFromExcel

2014-10-20 Thread Dan Murphy
Nice. So if someone were to offer a currency regular expression that works in their locale, I should also ask them to give me the results of Sys.getlocale("LC_MONETARY") and options("OutDec") and confirm that MS Excel honors that OutDec. Thank you, David. -Dan On Mon, Oct 20, 2014 at 10:04 AM, Dav

Re: [R] format negative numbers

2014-10-20 Thread MacQueen, Don
You could do it with minimal use of regular expressions, along the lines of this example: x <- c('123','2.31','2.313-', '45-') is.neg <- grepl('-',x) xn <- x xn[is.neg] <- paste0( '-', substring(x[is.neg],1, nchar(x[is.neg])-1)) xn <- as.numeric(xn) I made a copy, 'xn', so that

Re: [R] pasteFromExcel

2014-10-20 Thread David Winsemius
On Oct 19, 2014, at 11:18 PM, Dan Murphy wrote: > To Users of Excel: > > Following advice from Brian and Markus, I created an RMarkdown "vignette" > that shows an example of how the pasteFromExcel function in the excelRio > package on github could be used by an actuary to transfer a triangle fro

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread William Dunlap
tuneR::readMP3 may not be allocating (or freeing) memory correctly. On both Linux and Windows I get the following (where 'jingle.mp3' is a sample mp3 that comes with Processing 2.1 which has a quarter million samples in it). If I do this as a sequence of top-level expression instead of as a for l

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread John McKown
On Mon, Oct 20, 2014 at 10:30 AM, Dimitri Liakhovitski < dimitri.liakhovit...@gmail.com> wrote: > Dear Rers, > > I am trying to run a for-loop in R. > During each iteration I read in an mp3 file and do some basic processing. > If I do what I need to do for each file one by one - it works fine. > B

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread Jeff Newmiller
It is your responsibility (not mine) to simplify your example to the point where it is small, self-contained, and reproducible (see the footer of this message). In fact, doing so often highlights the issue to you before you share it. If any old downloadable mp3 file can be used to reproduce the

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread Dimitri Liakhovitski
Jeff, here is what I do with each file using library(tuneR): b<-readMP3("cairnomount.mp3") myrange<-range(b@left) write.table(myrange,"x myrange.txt",sep="\t") Would you like me to attach a bunch of large mp3 files? I don't feel I have the right to clog people's inboxes with large files. Thanks

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread Jeff Newmiller
You don't say what processing you are doing.. the answer to your question is very likely there. To communicate effectively on this mailing list, self-contained examples are needed. And in order to not corrupt the example you will need to post in plain text. --

[R] How to clear R memory in a for loop

2014-10-20 Thread Dimitri Liakhovitski
Dear Rers, I am trying to run a for-loop in R. During each iteration I read in an mp3 file and do some basic processing. If I do what I need to do for each file one by one - it works fine. But once I start running a loop, it soon runs out of memory and says: can't allocate a vector of size... In e

Re: [R] making a plot

2014-10-20 Thread Andrés Aragón
Enrico, This may help you: text(locator(1), "*", cex=1.5,adj=0.5 and text(locator(1), "º", cex=1.5,adj=0.5 Draw your plot, then write the code, locate the cursor on your plot, put the symbols where you want itl and click. Regards, Andrés PS ?locator 2014-10-20 9:46 GMT-05:00 Enrico C

[R] making a plot

2014-10-20 Thread Enrico Colosimo
Dear all, I am struggling to make a plot for my survival analysis class. This is my script labels<-c('1','2','3','4','5','6') ano<-c(2001,2002,2003,2004,2006,2008) ranges<-c(6,3,4,5,4,2) dotchart(ano, labels=labels, xlab='ano', ylab='Pacientes',pch=20,xlim=c(min(ano), max(ano+ranges))) se

[R] how to predict scores after varimax rotation (using prcomp() and varimax())?

2014-10-20 Thread David Villegas Ríos
Hello. I ran a PCA analysis on a dataset with 5 variables and retained two components. I rotated them and now I want to predict the scores in a new data set for which the original variables are available. I normally use the predict.prcomp() function to predict using a prcomp object. For example..

[R] strange loadings matrix after varimax rotation: PCA with prcomp in R

2014-10-20 Thread David Villegas Ríos
Hello. I ran a PCA analysis on a dataset with 5 variables and retained two components. I rotated them and now I want to predict the scores in a new data set for which the original variables are available. I normally use the predict.prcomp() function to predict using a prcomp object. For example..

[R] matching genes to a list of gene groups an built binary data frame

2014-10-20 Thread Karim Mezhoud
Dear All, I have a gene list Genes <- c("ACACA", "BAX" , "BCL2", "BID", "BAX", "MAPK9") and a list of group of genes ListGroup <- list(group1=c("ACACA" ,"AHSA1" ,"AIMP2", "AKR1B1", "AKT1", "AKT1S1"), group2=c("ANXA1" , "AR" , "ARID1A" , "ATM" , "BAK1" , "BAX" ), g

Re: [R] how to judge a virable is a integer?

2014-10-20 Thread S Ellison
> 3. all.equal(a, as.integer(a)) Closer, but be aware that all.equal will not always return TRUE or FALSE and - more importantly - as.integer truncates towards zero and does NOT generally round to the nearest integer. a <- 4 - sqrt(2)^2 #Analytically 2 all.equal(a, as.integer(a)) # [1] "Mean re

Re: [R] how to judge a virable is a integer?

2014-10-20 Thread S Ellison
> It's due to that, 1 is a numeric, 1.2 is a numeric, though it's true. but > deeply, > when i want to know 1 is an integer,  there seems no easy way to get the > answer. > So, is there anyone happen to know it? First, you are not being as clear as you may think when you say " when i want to kno

Re: [R] format negative numbers

2014-10-20 Thread PIKAL Petr
Hi Thanks to all who responded. My input string is rather clumsy. Actually it can have leading or trailing empty space too, it can be mixture of positive and negative numbers. In the meantime I made small function which just strips of - sign and make numbers from factors, find numbers which ha

[R] create vector objects by recurrence equation function

2014-10-20 Thread rl
Subscribers, A spreadsheet contains (what appears to a low aptitude mathematician!) a recurrence equation: cellb1=2cellc1=0.1 celld1=5 cella2=1/(k1*cellb1)cellb2=cellb1+cellc1+celld1 cellc2=cella2*cellb2 celld2=cellb2*k2 where k are constants. Could someone p

Re: [R] format negative numbers

2014-10-20 Thread Marc Girondot
Is it what you want? > st <- "0.123-" > gsub("(.+)(-)", "\\2\\1", st) [1] "-0.123" > st <- "0.123" > gsub("(.+)(-)", "\\2\\1", st) [1] "0.123" Sincerely Marc Le 20/10/2014 09:03, PIKAL Petr a écrit : Dear all. Before I start fishing in (for me) murky regular expression waters I try to ask co

Re: [R] format negative numbers

2014-10-20 Thread Rainer Schuermann
Maybe not the most elegant way but at least works: library( stringr ) x <- as.factor( "123.4-" ) x <- -as.numeric( str_replace( as.character( x ), "-", "" ) ) x [1] -123.4 On Monday 20 October 2014 09:03:36 PIKAL Petr wrote: > Dear all. > > Before I start fishing in (for me) murky regular expr

[R] dbHasCompleted() always returns TRUE for POSTGRES Database with RJDBC?

2014-10-20 Thread julian . bothe
Hello Simon, Hello everyone, I have a problem with retrieving database-queries chunkwise. In my query (Postgresql-Database, Postgres-Version 9.1) dbHasCompleted seems to always return TRUE. dbGetQuery works for smaller tables, but not for the whole query, since then a Heap-Overflow-Error will o

[R] saving parameters as a variable

2014-10-20 Thread M Fatemi
Hi; In the simulation studies we need to save some measure in the output as a variable to do some calculation on them, how we can do that? For example: the p-value , t-value, in t-test ( t.test( ) ) or The estimated parameters in some models,(Ex: IRT model: graded response model) in ltm packag

Re: [R] distance from fitted line

2014-10-20 Thread eliza botto
Thankyou very much Joachim. Actually I already know the residual() command. I only wanted to know that is there a way to account for the fitted lines? its more of a criosity rather than a problem. :) Thankyou very much once again. Eliza To: eliza_bo...@hotmail.com Subject: Re: [R] distance fro

Re: [R] Dry Spell Problem.

2014-10-20 Thread Pascal Oettli
Hi, Did you have a look at the "dw.spell" function from the "RMRAINGEN" package? It might be a starting point for you. Regards, Pascal On Mon, Oct 20, 2014 at 4:47 PM, Frederic Ntirenganya wrote: > Dear All, > > I want to solve the following problem on a climatic dataset. It contains > Year, Da

[R] need help for predictive analytics part

2014-10-20 Thread Swapnil Khobragade
Hello sir, Actually, I 'm novice to R programming and currently working on prediction part for CPU usage log file (attached with mail). My task is to predict next hour CPU usage by taking "Time" as response and %user%nice %system %iowait%steal %idle, either all or one as pred

[R] FW: need help for predictive analytics part

2014-10-20 Thread Swapnil Khobragade
Hello sir, Actually, I 'm novice to R programming and currently working on prediction part for CPU usage log file (attached with mail). My task is to predict next hour CPU usage by taking "Time" as response and %user%nice %system %iowait%steal %idle, either all or one as pre

[R] Dry Spell Problem.

2014-10-20 Thread Frederic Ntirenganya
Dear All, I want to solve the following problem on a climatic dataset. It contains Year, Day and Rain as Columns names. Ex: > head(Samaru56) Year Day Rain 1 1928 10 2 1928 20 3 1928 30 4 1928 40 5 1928 50 6 1928 60 The first day from April 01 that gets more

[R] need help for predictive analytics part

2014-10-20 Thread Swapnil Khobragade
Hello sir, Actually, I 'm novice to R programming and currently working on prediction part for CPU usage log file (attached with mail). My task is to predict next hour CPU usage by taking "Time" as response and %user%nice %system %iowait%steal %idle, either all or one as pred

[R] format negative numbers

2014-10-20 Thread PIKAL Petr
Dear all. Before I start fishing in (for me) murky regular expression waters I try to ask community about changing format of negative numbers. For some reason I get a file with negative numbers formatted with negative sign at end of number. something like 0.123- It is imported as factors and

Re: [R] 2 missing observation of LSD analysis in R

2014-10-20 Thread Frederic Ntirenganya
I guess you can use na.string="1st missing value " then data[data==second missing value]<-NA. On Mon, Oct 20, 2014 at 9:21 AM, Jomy Jose wrote: > How to deal with the analysis of 2 missing observations in case of Latin > square design > > [[alternative HTML version deleted]] > > ___