[R] R with openblas and atlas

2013-10-31 Thread Li Bowen
Hi, I have been trying to build R with optimized BLAS library. I am using a Ubuntu 13.10 x86_64 desktop, on which I am able to build R with openblas without any problem: #BEGIN_SRC sh ./configure --enable-BLAS-shlib --enable-R-shlib LIBnn=lib --disable-nls --with-blas="-L/usr/lib/openblas-base/

Re: [R] Extracting values from a ecdf (empirical cumulative distribution function) curve

2013-10-31 Thread Duncan Mackay
Hi There is a print method for ecdf So print(f) should give you an idea of what is going on See ?ecdf HTH Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original Message- From: r-help-boun.

Re: [R] Extracting values from a ecdf (empirical cumulative distribution function) curve

2013-10-31 Thread William Dunlap
> it gives 'NA' (for whatever y value). What 'y' values were you using? inf_f maps probabilities (in [0,1]) to values in the range of the orginal data, x, but it will have problems for a probability below 1/length(x) because the original data didn't tell you anything about the ecdf in that region

Re: [R] Extracting values from a ecdf (empirical cumulative distribution function) curve

2013-10-31 Thread Manoranjan Muthusamy
Thank you, Barradas. It works when finding y, but when I tried to find x using interpolation for a known y it gives 'NA' (for whatever y value). I couldn't find out the reason. Any help is really appreciated. Thanks, Mano On Thu, Oct 31, 2013 at 10:53 PM, Rui Barradas wrote: > Hello, > > As fo

Re: [R] Efficient way to convert covariance to Euclidian distance matrix

2013-10-31 Thread Takatsugu Kobayashi
Thanks all. I will "get real" and try to reduce the size of covariance matrix. Taka On Fri, Nov 1, 2013 at 8:01 AM, Rolf Turner wrote: > On 10/31/13 23:14, Takatsugu Kobayashi wrote: > >> Hi RUsers, >> >> I am struggling to come up with an efficient vectorized way to convert >> 20Kx20K covar

Re: [R] Efficient way to convert covariance to Euclidian distance matrix

2013-10-31 Thread Rolf Turner
On 10/31/13 23:14, Takatsugu Kobayashi wrote: Hi RUsers, I am struggling to come up with an efficient vectorized way to convert 20Kx20K covariance matrix to a Euclidian distance matrix as a surrogate for dissimilarity matrix. Hopefully I can apply multidimensional scaling for mapping these 20K p

Re: [R] Lattice Legend/Key by row instead of by column

2013-10-31 Thread Duncan Mackay
Hi Richard If you cannot get a better suggestion this example from Deepayan Sarkar may help. It is way back in the archives and I do not have a reference for it. I have used it about a year ago as a template to do a complicated key fl <- grid.layout(nrow = 2, ncol = 6, height

Re: [R] quickly extract response from formula

2013-10-31 Thread David Winsemius
On Oct 31, 2013, at 1:27 PM, Andreas Leha wrote: > Hi all, > > what is the recommended way to quickly (and without much burden on the > memory) extract the response from a formula? If you want its expression value its just form[[2]] If you wnat it evaluated in the environment of a dataframe th

Re: [R] Extracting values from a ecdf (empirical cumulative distribution function) curve

2013-10-31 Thread Rui Barradas
Hello, As for the problem of finding y given the ecdf and x, it's very easy, just use the ecdf: f <- ecdf(rnorm(100)) x <- rnorm(10) y <- f(x) If you want to get the x corresponding to given y, use linear interpolation. inv_ecdf <- function(f){ x <- environment(f)$x y <- env

Re: [R] set difference between two data frames

2013-10-31 Thread arun
Also, you could try: library(sqldf) sqldf('SELECT * FROM df1 EXCEPT SELECT * FROM df2') A.K. On Thursday, October 31, 2013 4:28 PM, Rui Barradas wrote: Hello, Try the following. (I don't remember who wrote this function but I saw it in R-Help) setdiffDF <- function(A, B){     f <- func

Re: [R] set difference between two data frames

2013-10-31 Thread Simon Zehnder
You could e.g. take the data.table package (every data.table is a data.frame) and make a join: dt.x <- data.table(x) dt.y <- data.table(y) merge.xy <- x[y, nomatch = 0] diff.xy <- x[!merge.xy] On 31 Oct 2013, at 21:41, Yasin Gocgun wrote: > Thanks. Actually, I forgot to add that both have th

Re: [R] set difference between two data frames

2013-10-31 Thread Yasin Gocgun
Thanks. Actually, I forgot to add that both have the same number of columns. On Thu, Oct 31, 2013 at 4:07 PM, Bert Gunter wrote: > lapply() setdiff() by columns. > > Unless you have failed to tell us something, you almost certainly will > not get a data frame (same number of rows/column) as your

[R] Lattice Legend/Key by row instead of by column

2013-10-31 Thread Richard Kwock
Hi All, I am having some trouble getting lattice to display the legend names by row instead of by column (default). Example: library(lattice) set.seed(456846) data <- matrix(c(1:10) + runif(50), ncol = 5, nrow = 10) dataset <- data.frame(data = as.vector(data), group = rep(1:5, each = 10), time

[R] quickly extract response from formula

2013-10-31 Thread Andreas Leha
Hi all, what is the recommended way to quickly (and without much burden on the memory) extract the response from a formula? The standard way to extract the response from a formula seems to be via model.frame() or model.extract(), but that is very memory intensive. Here is a quick example, that (

Re: [R] set difference between two data frames

2013-10-31 Thread Rui Barradas
Hello, Try the following. (I don't remember who wrote this function but I saw it in R-Help) setdiffDF <- function(A, B){ f <- function(A, B) A[!duplicated(rbind(B, A))[nrow(B) + 1:nrow(A)], ] df1 <- f(A, B) df2 <- f(B, A) rbind(df1, df2) } df1 <- data.frame(A = 1:10,

[R] help with ggplot legend specification

2013-10-31 Thread Conklin, Mike (GfK)
I am creating a scatterplot with the following code. pl<-ggplot(df,aes(x=Importance,y=Performance,fill=PBF,size=gapsize))+ geom_point(shape=21,colour="black")+scale_size_area(max_size=pointsizefactor) points are plotted where the size of the point is related to a metric variable gapsize

Re: [R] set difference between two data frames

2013-10-31 Thread Bert Gunter
lapply() setdiff() by columns. Unless you have failed to tell us something, you almost certainly will not get a data frame (same number of rows/column) as your answer. -- Bert On Thu, Oct 31, 2013 at 12:58 PM, Yasin Gocgun wrote: > Hi, > > I have two data frames, say, x and y, where y is a subs

[R] set difference between two data frames

2013-10-31 Thread Yasin Gocgun
Hi, I have two data frames, say, x and y, where y is a subset of x. How can I find the set difference of these two data frames (i.e., x-y)? Thanks, -- Yasin Gocgun __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEA

Re: [R] Count number of consecutive zeros by group

2013-10-31 Thread William Dunlap
> None of this checks that runs of zero exist in a group; if they don't, you'll > get warnings > and -Inf in the output as max takes maxima of nothing. You can add extra > checks inside > the function if that bothers you. Just adding a second argument, 0, to the call to max() will take care of t

Re: [R] Count number of consecutive zeros by group

2013-10-31 Thread Hervé Pagès
Hi Carlos, With Bioconductor, this can simply be done with: library(IRanges) ID <- Rle(1:3, c(3,2,4)) x <- Rle(c(1,0,0,0,0,1,1,0,1)) groups <- split(x, ID) idx <- groups == 0 Then: > max(runLength(idx)[runValue(idx)]) 1 2 3 2 2 1 Should be fast even with hundreds of thousands

Re: [R] Moving averages shading / two colours / polygon

2013-10-31 Thread olo
Solution: http://learnr.wordpress.com/2009/10/22/ggplot2-two-color-xy-area-combo-chart/ -- View this message in context: http://r.789695.n4.nabble.com/Moving-averages-shading-two-colours-polygon-tp4679460p4679479.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] Count number of consecutive zeros by group

2013-10-31 Thread S Ellison
> If I apply your function to my test data: > > the result is > 1 2 3 > 2 2 2 > ... > I think f2 does not return the max of consecutive zeros, but the max of any > consecutve number... Any idea how to fix this? The toy example of tapply using f2 does indeed return the maximum run lengths i

Re: [R] Count number of consecutive zeros by group

2013-10-31 Thread arun
Hi, May be this helps: fun1 <- function(dat){  lst1 <- lapply(split(dat,dat$ID),function(y){  rl <- rle(y$x)  data.frame(ID=unique(y$ID),MAXZero=max(rl$lengths[rl$values==0]))  })  do.call(rbind,lst1)  } fun1(df) #  ID MAXZero #1  1   2 #2  2   2 #3  3   1 A.K. On Thursday, O

[R] Extracting values from a ecdf (empirical cumulative distribution function) curve

2013-10-31 Thread Manoranjan Muthusamy
Hi R users, I am a new user, still learning basics of R. Is there anyway to extract y (or x) value for a known x (or y) value from ecdf (empirical cumulative distribution function) curve? Thanks in advance. Mano. [[alternative HTML version deleted]] _

[R] Moving averages shading / two colours / polygon

2013-10-31 Thread olo
I am stuck at the following problem. I have two moving averages. One is faster than another. After plotting them I need to shade area between them in green when the faster is above slower and red where faster is below slower. Something like this: http://charts.stocktwits.com/production/original_9

Re: [R] Count number of consecutive zeros by group

2013-10-31 Thread Carlos Nasher
If I apply your function to my test data: ID <- c(1,1,1,2,2,3,3,3,3) x <- c(1,0,0,0,0,1,1,0,1) data <- data.frame(ID=ID,x=x) rm(ID,x) f2 <- function(x) { max( rle(x == 0)$lengths ) } with(data, tapply(x, ID, f2)) the result is 1 2 3 2 2 2 which is not what I'm aiming for. It should be 1 2 3

Re: [R] getting p-value for comparing to gam's from gmcv

2013-10-31 Thread S Ellison
> > I am trying to compare two different GAM fits. > > ... > > How can I get a p-value out of the anova? See ?anova.gam and pay attention to the 'test' argument. S Ellison *** This email and any attachments are confidential. Any u

Re: [R] Make Multiple plots in R

2013-10-31 Thread Chris Campbell
Hi Jusper The function plot is generic; the method used to create the image depends on the type of the data object with which you are working. So for example calling plot on an "lm" object actually calls plot.lm. If you type: > class(mybrick9) You will see the class of yo

Re: [R] an rpy2, R cgi type question

2013-10-31 Thread Collin Lynch
Not terribly verbose. If you google it there is a cgitb flag you can set to get verbose python output. It is off by default for deployment as it is a security hole but it is useful now. Collin. On Thu, 31 Oct 2013, Erin Hodgess wrote: > Hi again: > > Here is the web output: > > Interna

Re: [R] getting p-value for comparing to gam's from gmcv

2013-10-31 Thread David Winsemius
On Oct 30, 2013, at 7:27 PM, Robert Lynch wrote: > I am trying to compare two different GAM fits. > I have something like > Course.bam20 <-bam(zGrade ~ Rep + ISE + White + Female + Years + AP_TOTAL > + MATH + HSGPA+ EOP + factor(P7APrior, ordered = FALSE)+s(Yfrm7A,k=20), > data= Course, na.acti

Re: [R] an rpy2, R cgi type question

2013-10-31 Thread Erin Hodgess
I think you're right...but thanks for your help and time! Sincerely, Erin On Thu, Oct 31, 2013 at 10:01 AM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > This really has become a python discussion and is probably better held > elsewhere, but my hunch is that you give a relative p

[R] arules package apriori() fn error message XXXX

2013-10-31 Thread Dan Abner
Hi everybody, I am using the apriori() fn in the arules package and am encountered an error. rules <- apriori(rdayst,parameter = list(support = 0.01, confidence = 0.6)) "You chose a very low absolute support count of 0. You might run of memory." I assume this is related to the value of .01 spe

[R] Download CSV Files from EUROSTAT Website

2013-10-31 Thread Lorenzo Isella
Dear All, I often need to do some work on some data which is publicly available on the EUROSTAT website. I saw several ways to download automatically mainly the bulk data from EUROSTAT to later on postprocess it with R, for instance http://bit.ly/HrDICj http://bit.ly/HrDL10 http://bit.ly/HrD

Re: [R] an rpy2, R cgi type question

2013-10-31 Thread R. Michael Weylandt
This really has become a python discussion and is probably better held elsewhere, but my hunch is that you give a relative path and Apache doesn't start python with the pwd you expect. Michael On Oct 31, 2013, at 9:12, Erin Hodgess wrote: > I checked the error logs, and the error appears on

Re: [R] Beginner having issues with making pie charts and other graphs

2013-10-31 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Carl Witthoft > Sent: Thursday, October 31, 2013 12:27 PM > To: r-help@r-project.org > Subject: Re: [R] Beginner having issues with making pie charts and > other graphs > > R

Re: [R] Make Multiple plots in R

2013-10-31 Thread David Carlson
You've left out all the critical code where you set graphics parameters (par()) to place four figures on one page. Probably you have reduced the margins so that there is no room for your labels. Note that xlab is printed but not ylab and there is no space for it. --

Re: [R] an rpy2, R cgi type question

2013-10-31 Thread Erin Hodgess
I checked the error logs, and the error appears on the line in which I open the bz2.R file. It's definitely there, and I set the permissions to 777 for experimental permissions. On Thu, Oct 31, 2013 at 7:04 AM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > > > On Oct 31, 2013, at

Re: [R] Read ENVI files and extract stats in R

2013-10-31 Thread Carl Witthoft
That is not an ENVI file. That's an image file... or something. If you can post a small, reproducible sample of the data array containing the dates you wish to manipulate, we may be able to help. -- View this message in context: http://r.789695.n4.nabble.com/Read-ENVI-files-and-extract-stats

Re: [R] an rpy2, R cgi type question

2013-10-31 Thread R. Michael Weylandt
On Oct 31, 2013, at 1:50, Erin Hodgess wrote: > Hi again: > > Here is the web output: > > Internal Server Error > > The server encountered an internal error or misconfiguration and was unable > to complete your request. So your Python code is raising an exception somewhere, not the apache c

Re: [R] ggplot2 - how to get rid of bar boarder lines

2013-10-31 Thread John Kane
At a guess, don't use colour. John Kane Kingston ON Canada > -Original Message- > From: dimitri.liakhovit...@gmail.com > Sent: Wed, 30 Oct 2013 14:11:37 -0400 > To: r-help@r-project.org > Subject: [R] ggplot2 - how to get rid of bar boarder lines > > Hello! > > I am using ggplot2: > >

Re: [R] Make Multiple plots in R

2013-10-31 Thread John Kane
Without knowing what the data looks like it is a bit difficult to know. See ?dput on how to supply sample data. However I think that something like the ggplot2 package would be a good way to go, John Kane Kingston ON Canada > -Original Message- > From: j.kipl...@cgiar.org > Sent: Th

Re: [R] Count number of consecutive zeros by group

2013-10-31 Thread S Ellison
> -Original Message- > So I want to get the max number of consecutive zeros of variable x for each > ID. I found rle() to be helpful for this task; so I did: > > FUN <- function(x) { > rles <- rle(x == 0) > } > consec <- lapply(split(df[,2],df[,1]), FUN) You're probably better off wit

Re: [R] Beginner having issues with making pie charts and other graphs

2013-10-31 Thread Carl Witthoft
Rule Number One: Don't use pie charts. Rule Number Two: NEVER EVER USE PIE CHARTS! To learn how to create graphs in R, start with ?plot , ?points, ?lines. Later on you can investigate ?lattice, ?grid, and ?ggplot2 . The fact that you're looking 'online' instead of in R's builtin help mechan

Re: [R] Rterm

2013-10-31 Thread Duncan Murdoch
On 13-10-30 5:34 PM, Patrick Rioux wrote: Hi, Whenever I try to open R from Emacs, it says : "apply: Searching for program: permission denied, Rterm" I have the new ESS with the latest Emacs version and R-3.0.2. Also, when I open Emacs, it says : "No version of R could be found on your system".

Re: [R] Efficient way to convert covariance to Euclidian distance matrix

2013-10-31 Thread S Ellison
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Takatsugu Kobayashi > > I am struggling to come up with an efficient vectorized way to convert > 20Kx20K covariance matrix to a Euclidian distance matrix as a surrogate for > di

[R] Count number of consecutive zeros by group

2013-10-31 Thread Carlos Nasher
Dear R-helpers, I need to count the maximum number of consecutive zero values of a variable in a dataframe by different groups. My dataframe looks like this: ID <- c(1,1,1,2,2,3,3,3,3) x <- c(1,0,0,0,0,1,1,0,1) df <- data.frame(ID=ID,x=x) rm(ID,x) So I want to get the max number of consecutive z

[R] Matrix calculations from database linked to in RODBC

2013-10-31 Thread Bridget Helwig
I am back to R after a long absence and have a few questions. I have connected to a very large Microsoft Access database through RODBC in hopes that I would be able to do some matrix algebra on the many tables I have loaded into the database. What I am thinking of doing is to assign specific colum

Re: [R] big speed difference in source btw. R 2.15.2 and R 3.0.2 ?

2013-10-31 Thread Heinz Tuechler
on/am 31.10.2013 09:12, Prof Brian Ripley wrote/hat geschrieben: On 30/10/2013 21:15, William Dunlap wrote: I have to defer to others for policy declarations like how long the current format used by load and save should be readable. You could also ask how long R will last R can still rea

[R] Efficient way to convert covariance to Euclidian distance matrix

2013-10-31 Thread Takatsugu Kobayashi
Hi RUsers, I am struggling to come up with an efficient vectorized way to convert 20Kx20K covariance matrix to a Euclidian distance matrix as a surrogate for dissimilarity matrix. Hopefully I can apply multidimensional scaling for mapping these 20K points (commercial products). I understand that

Re: [R] remap values from one vector to the other

2013-10-31 Thread Jim Lemon
On 10/31/2013 08:23 PM, Alaios wrote: Hi everyone, I am plotting some legend and I am using the axis(at=..) to specify the place to plot the marks I want. My plotted data have ncol(x) so the at places have values that span from 1 to ncol(x) there I would like to be able to map values that go

[R] SIAR problem with model running

2013-10-31 Thread Wobbe Gong
Hi there, I am trying to run an MCMC on stable isotope data from certain organisms to determine their dietary habits in the package SIAR. I have prepared my data according to Inger, R., Jackson, A., Parnell, A., Bearhop, S. : SIAR V4 (Stable Isotope Analysis in R) an Ecologist's Guide (also bette

Re: [R] remap values from one vector to the other

2013-10-31 Thread Gerrit Eichner
Alex, it is a bit unclear what you mean by "remap" etc., but maybe y0 <- 880e6; y1 <- 1020e6 x0 <- 1; x1 <- ncol(x) y0 + (x0-1):x1 * (y1 - y0)/(x1 - (x0-1)) gives what you want. Hth -- Gerrit On Thu, 31 Oct 2013, Alaios wrote: Hi everyone, I am plotting some legend and I am usi

Re: [R] numeric data being interpreted as a factor -trouble with reading data into a dataframe in R

2013-10-31 Thread PIKAL Petr
Hi Reading numeric as factor can have many causes from weird formating to some nonumeric characters. If you can not clean it when making *.csv file you shall either adopt reading function by using different options see ?read.table or if it does not help, you can either polish your values by so

[R] remap values from one vector to the other

2013-10-31 Thread Alaios
Hi everyone, I am plotting some legend and I am using the axis(at=..) to specify the place to plot the marks I want. My plotted data have ncol(x) so the at places have values that span from 1 to ncol(x) there I would like to be able to map values that go from 880e6 to 1020e6. so 880e6 rem

Re: [R] Automatically Remove Aliased Terms from a Model

2013-10-31 Thread Thaler,Thorn,LAUSANNE,Applied Mathematics
Dear Eik, Thanks for your answer. I think indeed I was not to clear of what I want to achieve. So let me rephrase: In case that there are aliased predictors in my model, I will see them via the alias function: d <- expand.grid(a = 0:1, b=0:1) d$c <- (d$a + d$b) %% 2 d$y <- rnorm(4) d <- withi

Re: [R] big speed difference in source btw. R 2.15.2 and R 3.0.2 ?

2013-10-31 Thread Prof Brian Ripley
On 30/10/2013 21:15, William Dunlap wrote: I have to defer to others for policy declarations like how long the current format used by load and save should be readable. You could also ask how long R will last R can still read (but not write) save() formats used in the 1990's. We would ex

Re: [R] Yield to maturity in R

2013-10-31 Thread Enrico Schumann
On Wed, 30 Oct 2013, Katherine Gobin writes: > Dear R forum, > > Just want to know if there is any function / package in R which will > calculate Yield to Maturity in R for a given bond? > > Regards > > Katherine require("sos") findFn("yield to maturity") -- Enrico Schumann Lucerne, Switzer

Re: [R] Irregular time series frequencies

2013-10-31 Thread Achim Zeileis
On Wed, 30 Oct 2013, sart...@voila.fr wrote: Hi everyone, I have a data frame with email addresses in the first column and in the second column a list of times (of different lengths) at which an email was sent from the user in the first column. Here is an example of my data: Email Email_sen