Re: [R] changing colors in filled.contour

2015-10-07 Thread William Dunlap
After
 mylevels <- seq(0,10,10)
mylevels has length 2, hence you get 2 colors.  Use length=10,


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, Oct 7, 2015 at 3:40 AM, begrinner  wrote:

> Dear R community!
>
> I haven't worked with R before but I found it has some nice abilities to
> create graphics. I made it to create a filled.contour with the settings I
> want but unfortunately I don't seem to be able to change colors. Instead of
> the standard colors, I'd like to get dark gray or black for higher values
> (instead of pink) and light gray or white for lower values (instead of
> cyan).  A second option I'd like to try is having colors change from green
> (low values) to red (high values)... but right now it seems like I'm miles
> away from that.
>
> This is what I have so far:
>
> model=function(a, b){+4+0.5*a-0.2*b}
> x=seq(-10, 10, by = 2)
> y=seq(0, 100, by = 10)
> z=outer(x, y, model)
> contour(x,y,z,nlevels=12)
> mylevels <- seq(0,10,10)
> filled.contour(x,y,z, main="Title")
>
> But when I try to Change the Color theme like this -
>
>
> filled.contour(x,y,z,levels=mylevels,col=grey(seq(0,1,length=length(mylevels
>
>  - I just get one white and one black bar.
>
> Does anyone of you know a solution?
>
> Thanks in advance, you'd help me a lot as I've been working on these few
> lines for a couple already.
>
> J
>
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/changing-colors-in-filled-contour-tp4713260.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] how to suppress to bring value labels with memisc pkg

2015-10-07 Thread Yongnam Kim
Hello all,

I know how to suppress to bring value labels from SPSS when importing sav
file using foreign package by "use.value.labels = FALSE" in read.spss
function. But, I don't know how to do the same thing when using memisc pkg,
in particular, with the spss.system.file function.

Many thanks!

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Quantile Regression without intercept

2015-10-07 Thread Roger Koenker

> On Oct 7, 2015, at 3:46 PM, Preetam Pal  wrote:
> 
> So, what does weighted quantile regression even aim to achieve? Invariably, 
> this plane would not split the data set into the requisite fractions…..


This officially ties this thread into a loop, since the OP wants to know why he 
wanted to do what he originally
requested.   If one “knows” that the intercept is zero, then it is always good 
to impose this, but like I said one
does this at one’s peril.  An example from economics might help:  suppose you 
are estimating Engel curves
in an unwelfare state, so 0 income implies 0 expenditure, then all (quantile)  
Engel curves pass through the origin and
one might want to impose this.  On the other hand maybe not...


> From: Roger Koenker
> Sent: ‎06-‎10-‎2015 07:09 PM
> To: Lorenz, David
> Cc: r-help@r-project.org
> Subject: Re: [R] Quantile Regression without intercept
> 
> 
> > On Oct 6, 2015, at 8:32 AM, Lorenz, David  wrote:
> > 
> > Thanks for the details, I suspected something like that.
> > I think that begs the question: what is the meaning of quantile regression 
> > through the origin? If the tau=.5 line does not pass through 1/2 the data 
> > how do I interpret the line?
> 
> As an estimate of the conditional median (quantile) function when constrained 
> to pass through
> the origin… as with least squares fitting without an intercept, you do this 
> at your peril.
> > 
> > 
> > On Tue, Oct 6, 2015 at 8:03 AM, Roger Koenker  wrote:
> > 
> > > On Oct 6, 2015, at 7:58 AM, Lorenz, David  wrote:
> > >
> > > Did you verify that the correct percentages were above/below the 
> > > regression
> > > lines? I did a quick check and for example did not consistently get 50% of
> > > the observed response values greater than the tau=.5 line. I did when I
> > > included the nonzero intercept term.
> > 
> > Your "correct percentages" are only correct when you have an intercept in 
> > the model,
> > without an intercept there is no gradient condition to ensure that.
> > >
> > >
> > >
> > >> Date: Mon, 5 Oct 2015 21:14:04 +0530
> > >> From: Preetam Pal 
> > >> To: stephen sefick 
> > >> Cc: "r-help@r-project.org" 
> > >> Subject: Re: [R] Quantile Regression without intercept
> > >> Message-ID: <56129a41.025f440a.b1cf4.f...@mx.google.com>
> > >> Content-Type: text/plain; charset="UTF-8"
> > >>
> > >> Yes..it works.  Thanks ??
> > >>
> > >> -Original Message-
> > >> From: "stephen sefick" 
> > >> Sent: ?05-?10-?2015 09:01 PM
> > >> To: "Preetam Pal" 
> > >> Cc: "r-help@r-project.org" 
> > >> Subject: Re: [R] Quantile Regression without intercept
> > >>
> > >> I have never used this, but does the formula interface work like lm? 
> > >> Y~X-1?
> > >>
> > >>
> > >> On Mon, Oct 5, 2015 at 10:27 AM, Preetam Pal 
> > >> wrote:
> > >>
> > >> Hi guys,
> > >>
> > >> Can you instruct me please how to run quantile regression without the
> > >> intercept term? I only know about the rq function under quantreg package,
> > >> but it automatically uses an intercept model. Icant change that, it 
> > >> seems.
> > >>
> > >> I have numeric data on Y variable (Gdp) and 2 X variables (Hpa and
> > >> Unemployment). Their sizes are 125 each.
> > >>
> > >> Appreciate your help with this.
> > >>
> > >> Regards,
> > >> Preetam
> > >>[[alternative HTML version deleted]]
> > >>
> > >> __
> > >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > >> https://stat.ethz.ch/mailman/listinfo/r-help
> > >> PLEASE do read the posting guide
> > >> http://www.R-project.org/posting-guide.html
> > >> and provide commented, minimal, self-contained, reproducible code.
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> --
> > >>
> > >> Stephen Sefick
> > >> **
> > >> Auburn University
> > >> Biological Sciences
> > >> 331 Funchess Hall
> > >> Auburn, Alabama
> > >> 36849
> > >> **
> > >> sas0...@auburn.edu
> > >> http://www.auburn.edu/~sas0025
> > >> **
> > >>
> > >> Let's not spend our time and resources thinking about things that are so
> > >> little or so large that all they really do for us is puff us up and make 
> > >> us
> > >> feel like gods.  We are mammals, and have not exhausted the annoying 
> > >> little
> > >> problems of being mammals.
> > >>
> > >>-K. Mullis
> > >>
> > >> "A big computer, a complex algorithm and a long time does not equal
> > >> science."
> > >>
> > >>  -Robert Gentleman
> > >>[[alternative HTML version deleted]]
> > >>
> > >>
> > >>
> > >>
> > >
> > >   [[alternative HTML version deleted]]
> > >

Re: [R] Error with Segmented package

2015-10-07 Thread David Winsemius

On Oct 7, 2015, at 6:50 AM, andrew haywood wrote:

> Dear List,
> 
> I am trying to run a simple pieewise regression using the segmented package.
> 
> When running the following code
> 
> library(segmented)
> data = data.frame(x=c(50,60,70,80,90,100,110) , y=
> c(703.786,705.857,708.153,711.056,709.257, 707.4, 705.6))
> 
> model.lm = segmented(lm(y~x,data = data),seg.Z = ~x, psi = NA, control =
> seg.control(K=1))
> 
> I get the following error.
> 
> Error in if (psi == Inf) psi <- median(XREGseg) :
>  missing value where TRUE/FALSE needed

I don't get any error, despite being a bit behind the times. You need to 
specify the versions (OS, R, segmented) and prepare for some debugging efforts. 
Easiest way to do this is with the output of sessionInfo(). 

R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin10.8.0 (64-bit)

I also have an embarrassing number of packages loaded.

other attached packages:
 [1] segmented_0.5-1.1   boot_1.3-17 sqldf_0.4-10  
 
(remaining 48 are omitted)


>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Quantile Regression without intercept

2015-10-07 Thread Preetam Pal
So, what does weighted quantile regression even aim to achieve? Invariably, 
this plane would not split the data set into the requisite fractions.

-Original Message-
From: "Roger Koenker" 
Sent: ‎06-‎10-‎2015 07:09 PM
To: "Lorenz, David" 
Cc: "r-help@r-project.org" 
Subject: Re: [R] Quantile Regression without intercept


> On Oct 6, 2015, at 8:32 AM, Lorenz, David  wrote:
> 
> Thanks for the details, I suspected something like that.
> I think that begs the question: what is the meaning of quantile regression 
> through the origin? If the tau=.5 line does not pass through 1/2 the data how 
> do I interpret the line?

As an estimate of the conditional median (quantile) function when constrained 
to pass through
the origin… as with least squares fitting without an intercept, you do this at 
your peril.
> 
> 
> On Tue, Oct 6, 2015 at 8:03 AM, Roger Koenker  wrote:
> 
> > On Oct 6, 2015, at 7:58 AM, Lorenz, David  wrote:
> >
> > Did you verify that the correct percentages were above/below the regression
> > lines? I did a quick check and for example did not consistently get 50% of
> > the observed response values greater than the tau=.5 line. I did when I
> > included the nonzero intercept term.
> 
> Your "correct percentages" are only correct when you have an intercept in the 
> model,
> without an intercept there is no gradient condition to ensure that.
> >
> >
> >
> >> Date: Mon, 5 Oct 2015 21:14:04 +0530
> >> From: Preetam Pal 
> >> To: stephen sefick 
> >> Cc: "r-help@r-project.org" 
> >> Subject: Re: [R] Quantile Regression without intercept
> >> Message-ID: <56129a41.025f440a.b1cf4.f...@mx.google.com>
> >> Content-Type: text/plain; charset="UTF-8"
> >>
> >> Yes..it works.  Thanks ??
> >>
> >> -Original Message-
> >> From: "stephen sefick" 
> >> Sent: ?05-?10-?2015 09:01 PM
> >> To: "Preetam Pal" 
> >> Cc: "r-help@r-project.org" 
> >> Subject: Re: [R] Quantile Regression without intercept
> >>
> >> I have never used this, but does the formula interface work like lm? Y~X-1?
> >>
> >>
> >> On Mon, Oct 5, 2015 at 10:27 AM, Preetam Pal 
> >> wrote:
> >>
> >> Hi guys,
> >>
> >> Can you instruct me please how to run quantile regression without the
> >> intercept term? I only know about the rq function under quantreg package,
> >> but it automatically uses an intercept model. Icant change that, it seems.
> >>
> >> I have numeric data on Y variable (Gdp) and 2 X variables (Hpa and
> >> Unemployment). Their sizes are 125 each.
> >>
> >> Appreciate your help with this.
> >>
> >> Regards,
> >> Preetam
> >>[[alternative HTML version deleted]]
> >>
> >> __
> >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >>
> >>
> >>
> >>
> >>
> >> --
> >>
> >> Stephen Sefick
> >> **
> >> Auburn University
> >> Biological Sciences
> >> 331 Funchess Hall
> >> Auburn, Alabama
> >> 36849
> >> **
> >> sas0...@auburn.edu
> >> http://www.auburn.edu/~sas0025
> >> **
> >>
> >> Let's not spend our time and resources thinking about things that are so
> >> little or so large that all they really do for us is puff us up and make us
> >> feel like gods.  We are mammals, and have not exhausted the annoying little
> >> problems of being mammals.
> >>
> >>-K. Mullis
> >>
> >> "A big computer, a complex algorithm and a long time does not equal
> >> science."
> >>
> >>  -Robert Gentleman
> >>[[alternative HTML version deleted]]
> >>
> >>
> >>
> >>
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
> 

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE 

[R] RSM in R, optimize/minimize a response

2015-10-07 Thread simon.heintz
Good morning
I'm trying to optimize (minimize actually) a response from a DOE with 4
factors. The 4 factors were built from a Latin Hypercube DOE design type.
Then I proceeded this experiment on 28 different cases, so each case will
include 2000 experiments.
I would like to find the factor quartet that will minimize globally the
response.
How can I find it? I built the script shown below, and I take the eigen
values from the rsm summary, but it's wrong, isn't it ?
I hope it's clear :)
Thank you in advance
Regards

I built the following script:

setwd("C:/Folder")
data <- read.table("File.txt",header=TRUE)
str(data)
summary(data)
data$block <- rep(1:28, each=2000)
library(rsm)
subset <- seq(from=min(data$Case),to=max(data$Case),by=1)
resu <- rsm(Response ~ block + SO(A,B,C,D),data=data[subset,])
summary(resu)

The file looks like the following:

CaseA   B   C   D   Response
1   1.05243 1.32528 0.9743521.03963 0.01615749
2   1.10323 1.055   0.9373141.19282 0.017107937
3   1.12744 1.06457 0.7724951.44226 0.016988281
4   1.17818 1.07334 1.40521 1.73733 0.016978022
5   1.17297 1.07055 0.9100721.15935 0.017274737
6   1.14439 0.7051050.91889 1.78162 0.01699969
7   1.0403  0.7781011.02743 1.41937 0.017164506
8   1.0847  0.7703171.16855 1.04109 0.017394582
9   1.03789 1.23609 1.43767 1.52393 0.015932553
10  1.12329 0.68861 1.23011 1.49413 0.01698659
...
11  ...
...
2150...
...
55999   1.19111 1.48329 0.8806591.82682 0.037803564
56000   1.11901 1.12973 0.5230261.92828 0.038733914



--
View this message in context: 
http://r.789695.n4.nabble.com/RSM-in-R-optimize-minimize-a-response-tp4713256.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Measure the frequencies of pairs in a matrix

2015-10-07 Thread Hermann Norpois
Ok, this was misleading. And was not that important. My result matrix
should look like this:

  12   3   4   5   6   7 ...
1 p1 p2
2 p
3
4

p1 etc are the frequencies of the combinations

1 and 2 for instance do not appear in my example. So the values would be
zero. Actually, this part is not too important. I would be happy enough to
solve the challenge with the frequencies of the pairs.
Thanks Hermann

2015-10-07 2:40 GMT+02:00 Boris Steipe :

> Since order is not important to you, you can order your pairs (e.g.
> decreasing) before compiling the frequencies.
> But I don't understand the second part about values "that do not appear in
> the matrix". Do you mean you want to assess all combinations? If that's the
> case I would think about a hash table or other indexed data structure,
> rather than iterating through a matrix.
>
>
> B.
>
>
>
> On Oct 6, 2015, at 4:59 PM, Hermann Norpois  wrote:
>
> > Hello,
> >
> > I have a matrix mat (see dput(mat))
> >
> >> mat
> >  [,1] [,2]
> > [1,]56
> > [2,]65
> > [3,]54
> > [4,]55
> > 
> >
> > I want the frequencies of the pairs in a new matrix, whereas the
> > combination 5 and 6 is the same as 6 and 5 (see the first two rows of
> mat).
> > In other words: What is the probability of each combination (each row)
> > ignoring the order in the combination. As a result I would like to have a
> > matrix that includes rows and cols 0, 1, 2 ... max (mat) that do not
> appear
> > in my matrix.
> >
> > dput (mat)
> > structure(c(5, 6, 5, 5, 4, 3, 6, 7, 4, 7, 5, 5, 5, 5, 6, 5, 5,
> > 4, 3, 6, 7, 4, 7, 5, 5, 5, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7,
> > 6, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7, 6), .Dim = c(26L, 2L))
> >
> > Thanks
> > Hermann
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Installing pre-compiled R in Linux

2015-10-07 Thread Sasikumar Kandhasamy
Thanks a lot Mike. The Linux distribution we use is "Red Hat Enterprise
Linux Server release 6.2".

Also, couple of clarifications,

1. Do we have a R package compatibility matrix against the Linux kernel
version? Or for the Red Hat Linux with kernel version 2.6.32-279, do you
have any suggestion/recommendation on R package to be used?

2. If we need to use Rscripts in embedded systems such as routers and
switches, do we need to install the complete R package in the  system also?
Or just libR.so and Rscript should be ok?

Thanks again Mike.

Regards
Sasi

On Tue, Oct 6, 2015 at 5:57 PM, Michael Hannon 
wrote:

> It's very likely that there is already an R package for your linux
> system, and, if so, you'd probably be well-served to use that one.
> You've given us the version of the kernel you're using (not a recent
> one, BTW), but what linux distribution are you using?
>
> -- Mike
>
>
> On Tue, Oct 6, 2015 at 3:59 PM, Sasikumar Kandhasamy 
> wrote:
> > Hi,
> >
> > I have downloaded the pre-compiled version of R package:
> > r-base-core(3.2.2-1) for i386 platform. Unzipped the package under my tmp
> > directory (/tmp). The directories "et"c and "usr" got created with
> binaries
> > R and Rscript under /tmp/usr/bin/.
> >
> > Executing the R (/tmp/usr/bin/R) or Rscript (/tmp/usr/bin/Rscipt) reports
> > the below error,
> >
> > ./usr/bin/R
> >  ./usr/bin/R: line 238:
> > /usr/lib/R/etc/ldpaths: No such file or directory
> > ERROR: R_HOME ('/usr/lib/R') not found
> >
> > How to reconfigure the R environment variables? Because, i tried setting
> > the R_HOME directory to "/tmp/usr/lib/R" but still not working.
> >
> > The Linux version i am using is  2.6.32. Please help me with the steps to
> > install the R correctly. Thanks.
> >
> > Regards
> > Sasi
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] non-linear fit and statistical significance

2015-10-07 Thread Juan Munoz-Garcia
Dear R users,

I’m using the constrOptim.nl to carry out non-linear fit 
with constraints between experimental and modelled data. As far as I understand 
the parameter “fval" indicates the goodness of this fit.
My first question is: Is the fval parameter similar to commonly used chi^2 
parameter?
Second: if you’d need to decide which set of models best fit your experimental 
data by comparing the different fval values obtained, how can you use R to 
determine if the differences between fval values is statistically significant?

I´d appreciate your feedback.
Regards.
Juan C. Munoz-García

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Installing pre-compiled R in Linux

2015-10-07 Thread Michael Hannon
Hi, Sasi.  Yes, I think that getting familiar with R in a "friendly"
context before dealing with your embedded system is a good idea.  Note
that the non-GUI part of R is more or less identical across platforms.
Hence, you could experiment with it on a Macbook, a Surface tablet,
etc., etc., if you're just seeking to get established in R.

The hardware configuration of your embedded system seems reasonable,
but again, I don't know what your run-time requirements will be.  Note
in particular that R likes to have objects resident in memory, so if
you're trying to process a 40GB data file on your embedded system,
you're probably out of luck.

I would certainly start by trying to install the Debian package for R.
Even if you don't have apt-get, I would think you'd at least have the
"dpkg" utility:

https://www.debian.org/doc/manuals/debian-faq/ch-pkgtools.en.html

If so, you could use that to install R (provided you have managed to
download the appropriate <*.deb> package for R).



On Wed, Oct 7, 2015 at 3:45 PM, Sasikumar Kandhasamy  wrote:
> Thanks Mike. From source, i am able to compile and use R in my red hat linux
> box. I was trying to get hands on using R in linux box before trying R on
> the embedded box.
>
> My requirement is to run R (R scripts) on my embedded box which has
> customized debian linux (kernel version 2.6.32) in batch mode without GUI
> support. The embedded box have multi-core MIPS processor with nearly 30GB
> RAM. I hope hardware resources on the embedded box shouldn't be an issue to
> run R (correct me if i am wrong), but linux version running here is an
> customized one with limited supporting services such as light weight shell
> etc.
>
> Given this, do i need to cross compile R package for my embedded box or i
> can directly install the debian MIPS version of R package. But there is no
> apt-get or other installer in the embedded box.
>
>
> Regards
> Sasi
>
> On Wed, Oct 7, 2015 at 1:46 AM, Michael Hannon 
> wrote:
>>
>> I don't think kernel compatibility is a significant issue for most
>> applications.  I can say for certain that I update the kernels on my
>> linux boxes without having to reinstall R.
>>
>> There *are* R packages for RHEL and friends.  Have a look at:
>>
>> https://cran.r-project.org/bin/linux/redhat/README
>>
>> Note that there's a bit of fiddling required, but I don't think it's
>> particularly complicated.
>>
>> It's usually not particularly difficult to install R from source.  If
>> you prefer to do that, have a look at:
>>
>> https://cran.r-project.org/doc/manuals/r-release/R-admin.html
>>
>> Also, you don't specify your requirements, but don't overlook the
>> possibility of installing a virtual machine on your RHEL server.
>> (It's somewhat easier to get an R package for Fedora or Ubuntu than
>> for RHEL, for instance.)
>>
>> I don't know the answer to your question about embedded systems.  I
>> would think R would not be a great choice for an embedded system, but
>> I don't know what your requirements are.
>>
>> -- Mike
>>
>>
>> On Tue, Oct 6, 2015 at 9:42 PM, Sasikumar Kandhasamy 
>> wrote:
>> > Thanks a lot Mike. The Linux distribution we use is "Red Hat Enterprise
>> > Linux Server release 6.2".
>> >
>> > Also, couple of clarifications,
>> >
>> > 1. Do we have a R package compatibility matrix against the Linux kernel
>> > version? Or for the Red Hat Linux with kernel version 2.6.32-279, do you
>> > have any suggestion/recommendation on R package to be used?
>> >
>> > 2. If we need to use Rscripts in embedded systems such as routers and
>> > switches, do we need to install the complete R package in the  system
>> > also?
>> > Or just libR.so and Rscript should be ok?
>> >
>> > Thanks again Mike.
>> >
>> > Regards
>> > Sasi
>> >
>> > On Tue, Oct 6, 2015 at 5:57 PM, Michael Hannon
>> > 
>> > wrote:
>> >>
>> >> It's very likely that there is already an R package for your linux
>> >> system, and, if so, you'd probably be well-served to use that one.
>> >> You've given us the version of the kernel you're using (not a recent
>> >> one, BTW), but what linux distribution are you using?
>> >>
>> >> -- Mike
>> >>
>> >>
>> >> On Tue, Oct 6, 2015 at 3:59 PM, Sasikumar Kandhasamy
>> >> 
>> >> wrote:
>> >> > Hi,
>> >> >
>> >> > I have downloaded the pre-compiled version of R package:
>> >> > r-base-core(3.2.2-1) for i386 platform. Unzipped the package under my
>> >> > tmp
>> >> > directory (/tmp). The directories "et"c and "usr" got created with
>> >> > binaries
>> >> > R and Rscript under /tmp/usr/bin/.
>> >> >
>> >> > Executing the R (/tmp/usr/bin/R) or Rscript (/tmp/usr/bin/Rscipt)
>> >> > reports
>> >> > the below error,
>> >> >
>> >> > ./usr/bin/R
>> >> >  ./usr/bin/R: line 238:
>> >> > /usr/lib/R/etc/ldpaths: No such file or directory
>> >> > ERROR: R_HOME ('/usr/lib/R') not found
>> >> >
>> >> > How to 

[R] ltraj contains irregular data

2015-10-07 Thread Wiebke Ullmann
Dear everyone,

as far as I understood the setNA function in adhabitat is there to produce rows 
in a location dataset that have not been recorded by the GPS collar. I just can 
not figure out where the problem is. Hope somebody can help me.



>daten$timestamp <- strptime(daten$study.local.timestamp,
format="%Y-%m-%d %H:%M")

>format(round(daten$timestamp, units="hours"),
format="%Y-%m-%d %H:%M:%S")

>daten$timestamp <-
as.POSIXct(daten$timestamp,format="%Y-%m-%d %H:%M:%S")

 

>u<-as.ltraj(daten[,c("utm.easting","utm.northing")],

 
daten$timestamp,id=daten$tag.local.identifier,

 
infolocs=daten[,c("tag.local.identifier",

  "individual.local.identifier")])

>head([[1]])

 

   x  
ydatedxdy dist

407063.1
5911535 2014-05-12 16:00:00  53.75844
-8.434472e+01 100.0200

407116.9
5911451 2014-05-12 17:00:00 -417115.85704 -5.921450e+06 5936122.8652

 -.0   -
2014-05-12 18:00:00   0.0  0.00e+00   0.

 -.0   -
2014-05-12 20:00:00  417008.07372  5.921561e+06 5936226.4139

407009.1
5911562 2014-05-12 21:00:00
156.63876  1.096218e+02 191.1874

407165.7
5911672 2014-05-12 23:00:00   
NANA   NA

dt  R2n  abs.angle 
rel.angle

3600
3.523851e+13 -1.0033541 -2.5038352

3600
3.523755e+13 -1.6411217 -0.6377675

7200
0.00e+00 NA NA

3600
0.00e+00  1.5004904 -3.1415732

7200
3.523878e+13  0.6106172 -0.8898732

NA   3.524021e+13 NA NA

 

 

>nex <- setNA(u,u[[1]]$date[1], 1*3600)

 

Fehler in
FUN(X[[i]], ...) : 

  ltraj
contains irregular data (time lag > or < tol)



If you need any additional information on what I have done I am happy to 
provide it (I am
not sure what you need to be able to help).

Thank you soo much in advance.

Cheers,
Wiebke

  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] changing colors in filled.contour

2015-10-07 Thread begrinner
Dear R community!

I haven't worked with R before but I found it has some nice abilities to
create graphics. I made it to create a filled.contour with the settings I
want but unfortunately I don't seem to be able to change colors. Instead of
the standard colors, I'd like to get dark gray or black for higher values
(instead of pink) and light gray or white for lower values (instead of
cyan).  A second option I'd like to try is having colors change from green
(low values) to red (high values)... but right now it seems like I'm miles
away from that.

This is what I have so far:

model=function(a, b){+4+0.5*a-0.2*b}
x=seq(-10, 10, by = 2)
y=seq(0, 100, by = 10)
z=outer(x, y, model)
contour(x,y,z,nlevels=12)
mylevels <- seq(0,10,10)
filled.contour(x,y,z, main="Title")

But when I try to Change the Color theme like this -

filled.contour(x,y,z,levels=mylevels,col=grey(seq(0,1,length=length(mylevels

 - I just get one white and one black bar. 

Does anyone of you know a solution?

Thanks in advance, you'd help me a lot as I've been working on these few
lines for a couple already.

J




--
View this message in context: 
http://r.789695.n4.nabble.com/changing-colors-in-filled-contour-tp4713260.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] problem with dataframes

2015-10-07 Thread Pau Marc Muñoz Torres
Hello everybody,

 I am using the library rapidr of bioconductor, I am running it without
problems as follows;

library("RAPIDR")
makeBinnedCountsFile("SRR611842_2.bam","SRR611842_2.bam.bai","binnecounts.r",mask=NULL,k=2)
> SampleID=c("SRR611842_2")
> DX=c("T21")
> Gender=c("Male")
> frame= data.frame(SampleID, DX, Gender)

No problems until here , but when i do

> createReferenceSetFromCounts("binnecounts.r",frame)
Loading binned counts file
Checking every sampleID has an outcome
No outcomes for Sample SRR611842_2.bam.bai
*Error in `[.data.frame`(sampleIDs.with.outcomes, , "Gender") :*
*  undefined columns selected*


I do not understand this error, it seems as if the column DX is not read by
the function and I do not know why. I have tried both spellings Dx and DX
with the same result.

I also cheked for the DX columns  doing

> frame
 SampleID  DX Gender
1 SRR611842_2 T21   Male
> frame$DX
[1] T21
Levels: T21
> names(frame)
[1] "SampleID" "DX"   "Gender"


 Can anyone suggest me what to do?


Pau Marc Muñoz Torres
skype: pau_marc
http://www.linkedin.com/in/paumarc
http://www.researchgate.net/profile/Pau_Marc_Torres3/info/

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] additive proportional odds model in R

2015-10-07 Thread Neverstop
Hi all!
I'm looking for a way to fit an additive proportional odds model in R since
I need to analyse ordinal data. 
The polr() function of the MASS package of R allows only to fit a linear
proportional odds model so I can't use it. 
The gam() function of the gam package of R allows to fit additive models and
generalized additive models. This package uses smoothing splines and loess
as smoothers. I've read the documentation and it doesn't seem to be possible
to fit an additive proportional odds model in R.  
Do you know which function should I use?
Thank you in advance.



--
View this message in context: 
http://r.789695.n4.nabble.com/additive-proportional-odds-model-in-R-tp4713259.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] MSwM R package: model and state probability significance (p00+p11=1)

2015-10-07 Thread Maxim Fomin
 Dear  R community,

It seems that MSwM package provides three model diagnostic tools:
pooled residuals plot, QQ plot and ACFs plot (via plotDiag). However, I cannot
find any statistic to test the whole model significance (and even for
each reported regime only multiple R^2 is provided).

After searching for the answer I found one paper (Lec-Markov_note.pdf
in web) which states  that there are two tests for MRSM model. The
first has long description and essentially links to Hansen (1992)
paper -  it tests whether switching parameters are nuisance. The
second test is H0: p00+p11=1 and can be tested with Wald test.

So, my question is follows. How the first test can be performed in R
and where to get variance of state probabilities to perform Wald test
of second hypothesis (I couldn't find relevant data in MSM.lm object)?

Thanks in advance,
Best regards,
Maxim Fomin

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Error with Segmented package

2015-10-07 Thread andrew haywood
Dear List,

I am trying to run a simple pieewise regression using the segmented package.

When running the following code

library(segmented)
data = data.frame(x=c(50,60,70,80,90,100,110) , y=
c(703.786,705.857,708.153,711.056,709.257, 707.4, 705.6))

model.lm = segmented(lm(y~x,data = data),seg.Z = ~x, psi = NA, control =
seg.control(K=1))

I get the following error.

Error in if (psi == Inf) psi <- median(XREGseg) :
  missing value where TRUE/FALSE needed

Any advice would be greatly appreciated.

Kind regards
Andrew

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] rpart cutpoint interpretation

2015-10-07 Thread Kishor Tappita
Hi All,

I am trying to derive cutpoint/threshold with a poisson distributed
dependent variable. I know how to interpret cutpoint with binary dependent
variable based on direction. Can some on help me to intrepret cutpoint for
poisson case with one independent variable with the derived threshold.

Thanks in advance.

Regards,
Kishor

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] extract all dataframes from list

2015-10-07 Thread PIKAL Petr
Hi

Or basically you can use for cycle. This can be as effective as lapply and if 
you plan to do some operations on your data frames maybe more manageable.

Cheers
Petr

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of maicel
> Sent: Tuesday, October 06, 2015 12:50 PM
> To: r-help@r-project.org
> Subject: [R] extract all dataframes from list
>
> Hello List, I have list of named dataframe. How can I extract all
> dataframes from this list? The dataframe names should be the same of
> the original list.
> May I use the lapply function?
>
> Thanks for your help. Best regards,
> Maicel Monzon, MD
> National Center of Clinical Trials
> Havana, Cuba
>
>
>
>
> --
> Este mensaje le ha llegado mediante el servicio de correo electronico
> que ofrece Infomed para respaldar el cumplimiento de las misiones del
> Sistema Nacional de Salud. La persona que envia este correo asume el
> compromiso de usar el servicio a tales fines y cumplir con las
> regulaciones establecidas
>
> Infomed: http://www.sld.cu/
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on behalf of the company except for cases in which he/she is 
expressly authorized to do so in writing, and such authorization or power of 
attorney is submitted to the recipient or the person represented by the 
recipient, or the existence of such authorization is known to the recipient of 
the person represented by the recipient.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Bug in auglag?

2015-10-07 Thread Rainer M Krug
Thanks a lot Ravi for the clarification and it makes sense - bug in my
understanding  acknowledged.

I'll change the objective function as suggested.

Thanks,

Rainer

Ravi Varadhan  writes:

> Dear Rainer,
> This is NOT a bug in auglag.  I already mentioned that auglag() can
> work with infeasible starting values, which also implies that the
> function must be evaluable at infeasible values.  A simple solution to
> your problem would be to fix up your objective function such that it
> evaluates to `Inf' or some large value, when the parameter values are
> not in the constrained domain.  constrOptim.nl() is a barrier method
> so it forces the initial value and the subsequent iterates to be
> feasible.
> Best,
> Ravi
> 
> From: Rainer M Krug 
> Sent: Tuesday, October 6, 2015 9:20 AM
> To: Ravi Varadhan
> Cc: 'r-help@r-project.org'
> Subject: Bug in auglag?
>
> Hi Ravi,
>
> I would like come back to your offer. I have a problem which possibly is
> caused by a bug or by something I don't understand:
>
> My function to be minimised is executed even when an element in hin() is
> negative.
>
> My hin looks as follow:
>
> hinMahat <- function(x, hauteur, na, zjoint, y, LAI, ...) {
> if (x[1] < 0) {
> cat(names(list(...)), "\n")
> cat(..., "\n")
> cat(x, "|", hauteur, LAI, y, "\n")
> }
>
> h <- rep(NA, 8)
> if (!missing(na)) {
> x <- c(na, x )
> }
> if (!missing(y)) {
> x <- c(x, y)
> }
> if (!missing(zjoint)) {
> x <- c(x[1], zjoint, x[2])
> }
>
> ##
> dep <- hauteur * (0.05 + LAI^0.02 / 2) + (x[3] - 1)/20
> h[1] <- dep
> h[2] <- hauteur - dep
> ## if (h[2]==0) {
> ## h[2] <- -1
> ## }
> ##
> z0 <- hauteur * (0.23 + LAI^0.25 / 10) + (x[3] - 1)/67
> h[3] <- z0
> ## if (h[3]==0) {
> ## h[3] <- -1
> ## }
> h[4] <- hauteur - z0
> ##
> h[5] <- x[1]
> ##
> h[6] <- x[2]
> h[7] <- hauteur - x[2]
> ##
> h[8] <- hauteur - dep - z0
> if (any(h<=0)) {
> cat(h, "\n")
> cat("\n")
> }
> return(h)
> }
>
> the x contains up to three elements: c(na=, zjoint=, y=) and I fit these
> three, unless one or two are specified explicitely.
>
> The values going into hin are:
>
> ,
> | ... (z  u ua za z0sol )
> | 3 11 17 23 29 37 0.315 0.422 0.458 0.556 1.567 1.747 1.747 37 0.001
> |
> | x(na, zjoint): -8.875735 24.51316
> | hauteur: 28
> | na:  8.1
> | y:   3
> |
> | the resulting hin() is:
> | 16.09815 11.90185 11.19352 16.80648 -8.875735 24.51316 3.486843 0.708335
> `
>
>
> Which is negative in element 5 as x[2]=na is negative.
>
> So I would expect that the function fn is not evaluated. But it is, and
> raises an error:
>
> ,
> | Error in wpLELMahat(z = z, ua = ua, na = ifelse(missing(na), par[1], na),  :
> |   na has to be larger or equal than zero!
> `
>
> Is this a misunderstanding on my part, or is it an error in the function
> auglag?
>
>
> Below is the function which is doing the minimisation.
>
> If I replace auglag() with constrOptim.nl(), the optimisation is working
> as expected.
>
> So I think this is a bug in auglag?
>
> Let me know if you need further information.
>
> Cheers,
>
> Rainer
>
> --8<---cut here---start->8---
> fitAuglag.wpLEL.mahat.single <- function(
>  z,
>  u,
>  LAI,
>  initial = c(na=9, zjoint=0.2*2, y=3),
>  na, zjoint, y,
>  h  = 28,
>  za = 37,
>  z0sol  = 0.001,
>  hin,
>  ...
>  ) {
> if (missing(hin)) {
> hin <- hinMahat
> }
>
> wpLELMin <- function(par, na, zjoint, y, z, u, ua, hauteur, za, z0sol, 
> LAI) {
> result <- NA
> try({
> p <- wpLELMahat(
> z  = z,
> ua = ua,
> na = ifelse(missing(na), par[1], na),
> zjoint = ifelse(missing(zjoint), par[2], zjoint),
> h  = hauteur,
> za = za,
> z0sol  = z0sol,
> LAI= LAI,
> y  = ifelse(missing(y), par[3], y)
> )
> result <- sum( ( (p$u - u)^2 ) / length(u) )
> },
> silent = FALSE
> )
> ## cat("From wpLELMin", par, "\n")
> return( result )
> }
>
> ua <- u[length(u)]
> result <- list()
> result$method <- "fitAuglag.wpLEL.mahat.single"
> result$initial <-  initial
> result$dot <- 

Re: [R] extract all dataframes from list

2015-10-07 Thread Gerrit Eichner

Hello, Maicel,

if you only want to extract info from those data frames, maybe it is 
enough to attach the list to the search path using attach (and afterwards 
detach()); see ?attach. Otherwise the online help page of assign() might 
be a starting point for you.


 Hth  --  Gerrit


Hi

Or basically you can use for cycle. This can be as effective as lapply 
and if you plan to do some operations on your data frames maybe more 
manageable.


Cheers
Petr


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of maicel
Sent: Tuesday, October 06, 2015 12:50 PM
To: r-help@r-project.org
Subject: [R] extract all dataframes from list

Hello List, I have list of named dataframe. How can I extract all
dataframes from this list? The dataframe names should be the same of
the original list.
May I use the lapply function?

Thanks for your help. Best regards,
Maicel Monzon, MD
National Center of Clinical Trials
Havana, Cuba



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Installing different R versions

2015-10-07 Thread Loris Bennett
Dear Luca,

Luca Cerone  writes:

> Dear all,
> on one shared machine we have an older R version installed. Some packages
> have known issues with that version that are fixed in newer R versions.
>
> Since that is a production machine with many jobs running we would like to
> keep things as they are. However I would also like to keep advantage of the
> newest version and the bug fixes introduced.
>
> What would be the best way to install a newer version along the one that
> already exists? Is it possible to install it for a specific user only?
>
> Cheers,
> Luca

If you are on a Unix-like platform, a standard way of dealing with
multiple versions of a piece of software installed in parallel is
"Environment Modules":

http://modules.sourceforge.net/

Packages for various Linux distributions are available.

You could make a version available for a specific user by setting
appropriate file permissions of the module file which is used to set up
the environment.  However, I would consider this a somewhat unusual
configuration.  If you are worried about people using the wrong version
by mistake, you can either have the standard version available without
using modules, or you can define a default version within the modules
setup.

HTH

Loris

-- 
This signature is currently under construction.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Polygon shade

2015-10-07 Thread Jim Lemon
Hi bgnum,
You can try something like this:

testdates<-as.Date(paste(1:30,"Sep",2015),"%d %b %Y")
nemails<-sample(10:30,30,TRUE)
library(plotrix)
stackpoly(testdates,nemails,col="blue")

Jim


On Wed, Oct 7, 2015 at 12:20 AM, bgnumis bgnum  wrote:

> Hi All,
>
> I want to shade the area below "f" variable and it doesn´t draw:
>
> plot(z$Dateh[nn:length(z$Dateh)],f,type="l",col="black", xlab="Time",
> ylab="Line")
> grid()
> polygon(c(1, 1:st, st),c(0, f, 0), col = "blue")
>
> st is the length of f.
>
> But if I plot
>
> plot(f,type="l",col="black", xlab="Time", ylab="Correlation")
> grid()
> polygon(c(1, 1:st, st),c(0, f, 0), col = "blue")
>
> But the axis doesn´t refect the date labels.
>
> ¿What should I do in the first code to achive it draws the blue?
>
> ¿If not? How can I ommit the axis in the scond code and to add the
> z$Dateh[nn:length(z$Dateh)?
>
> Hope someone can help me.
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] Installing different R versions

2015-10-07 Thread Luca Cerone
Dear all,
on one shared machine we have an older R version installed. Some packages
have known issues with that version that are fixed in newer R versions.

Since that is a production machine with many jobs running we would like to
keep things as they are. However I would also like to keep advantage of the
newest version and the bug fixes introduced.

What would be the best way to install a newer version along the one that
already exists? Is it possible to install it for a specific user only?

Cheers,
Luca

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] vector graphics

2015-10-07 Thread Ivan Calandra

Thanks Jean for the tip.
I'll try postscript() and devEMF::emf() and see if it works.
Still, it's very complicated to export vector graphics in R...

Ivan

--
Ivan Calandra, PhD
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.fr
https://www.researchgate.net/profile/Ivan_Calandra

Le 07/10/15 00:16, Adams, Jean a écrit :
Perhaps the discussion at this link will be helpful ... 
http://stackoverflow.com/questions/9555889/producing-a-vector-graphics-image-i-e-metafile-in-r-suitable-for-printing-in


Jean

On Tue, Oct 6, 2015 at 9:42 AM, Ivan Calandra 
> wrote:


Dear useRs,

A colleague of mine is having a problem with graphic devices. The
goal is to save into a vector graphic format that can be edited
with Illustrator CS4.

On my Mac (Snow Leopard), I use RSvgDevice::devSVG() and it works
fine.
But on her Windows Vista computer, I cannot find an alternative.>
sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows Vista (build 6002) Service Pack 2

I have tried:
- pdf(): I cannot dissociate the graphical elements (no problem
with text)
- cairo_pdf(): the text is replaced by symbols
- cairo_ps(): fine except that the text is not text but object (it
is then a bit troublesome, as any text modification requires the
text to be completely rewritten)
- svg(): the graphic is completely screwed up (it seems to be a
scaling problem, with symbols and letters all very large and
superposed)
- RSvgDevice cannot be installed on the Windows machine, neither
as binary nor from source.

Is there any other device that could work? If not, is it a matter
of settings? So, basically, what can I do?

Thank you in advance,
Ivan

-- 
Ivan Calandra, PhD

University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.fr 
https://www.researchgate.net/profile/Ivan_Calandra

__
R-help@r-project.org  mailing list --
To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Installing pre-compiled R in Linux

2015-10-07 Thread Michael Hannon
I don't think kernel compatibility is a significant issue for most
applications.  I can say for certain that I update the kernels on my
linux boxes without having to reinstall R.

There *are* R packages for RHEL and friends.  Have a look at:

https://cran.r-project.org/bin/linux/redhat/README

Note that there's a bit of fiddling required, but I don't think it's
particularly complicated.

It's usually not particularly difficult to install R from source.  If
you prefer to do that, have a look at:

https://cran.r-project.org/doc/manuals/r-release/R-admin.html

Also, you don't specify your requirements, but don't overlook the
possibility of installing a virtual machine on your RHEL server.
(It's somewhat easier to get an R package for Fedora or Ubuntu than
for RHEL, for instance.)

I don't know the answer to your question about embedded systems.  I
would think R would not be a great choice for an embedded system, but
I don't know what your requirements are.

-- Mike


On Tue, Oct 6, 2015 at 9:42 PM, Sasikumar Kandhasamy  wrote:
> Thanks a lot Mike. The Linux distribution we use is "Red Hat Enterprise
> Linux Server release 6.2".
>
> Also, couple of clarifications,
>
> 1. Do we have a R package compatibility matrix against the Linux kernel
> version? Or for the Red Hat Linux with kernel version 2.6.32-279, do you
> have any suggestion/recommendation on R package to be used?
>
> 2. If we need to use Rscripts in embedded systems such as routers and
> switches, do we need to install the complete R package in the  system also?
> Or just libR.so and Rscript should be ok?
>
> Thanks again Mike.
>
> Regards
> Sasi
>
> On Tue, Oct 6, 2015 at 5:57 PM, Michael Hannon 
> wrote:
>>
>> It's very likely that there is already an R package for your linux
>> system, and, if so, you'd probably be well-served to use that one.
>> You've given us the version of the kernel you're using (not a recent
>> one, BTW), but what linux distribution are you using?
>>
>> -- Mike
>>
>>
>> On Tue, Oct 6, 2015 at 3:59 PM, Sasikumar Kandhasamy 
>> wrote:
>> > Hi,
>> >
>> > I have downloaded the pre-compiled version of R package:
>> > r-base-core(3.2.2-1) for i386 platform. Unzipped the package under my
>> > tmp
>> > directory (/tmp). The directories "et"c and "usr" got created with
>> > binaries
>> > R and Rscript under /tmp/usr/bin/.
>> >
>> > Executing the R (/tmp/usr/bin/R) or Rscript (/tmp/usr/bin/Rscipt)
>> > reports
>> > the below error,
>> >
>> > ./usr/bin/R
>> >  ./usr/bin/R: line 238:
>> > /usr/lib/R/etc/ldpaths: No such file or directory
>> > ERROR: R_HOME ('/usr/lib/R') not found
>> >
>> > How to reconfigure the R environment variables? Because, i tried setting
>> > the R_HOME directory to "/tmp/usr/lib/R" but still not working.
>> >
>> > The Linux version i am using is  2.6.32. Please help me with the steps
>> > to
>> > install the R correctly. Thanks.
>> >
>> > Regards
>> > Sasi
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > __
>> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide
>> > http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>
>

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Installing pre-compiled R in Linux

2015-10-07 Thread Sasikumar Kandhasamy
Thanks a lot Mike & others for the valuable input. I was wrong on debian
linux on the embedded box, it is monta vista embedded linux.

I hope, there is no R core package available for monta vista distribution
and i may need to cross compile from R source. Please correct me if i am
wrong.

Thanks & Regards
Sasi

On Wed, Oct 7, 2015 at 4:02 PM, Michael Hannon 
wrote:

> Hi, Sasi.  Yes, I think that getting familiar with R in a "friendly"
> context before dealing with your embedded system is a good idea.  Note
> that the non-GUI part of R is more or less identical across platforms.
> Hence, you could experiment with it on a Macbook, a Surface tablet,
> etc., etc., if you're just seeking to get established in R.
>
> The hardware configuration of your embedded system seems reasonable,
> but again, I don't know what your run-time requirements will be.  Note
> in particular that R likes to have objects resident in memory, so if
> you're trying to process a 40GB data file on your embedded system,
> you're probably out of luck.
>
> I would certainly start by trying to install the Debian package for R.
> Even if you don't have apt-get, I would think you'd at least have the
> "dpkg" utility:
>
> https://www.debian.org/doc/manuals/debian-faq/ch-pkgtools.en.html
>
> If so, you could use that to install R (provided you have managed to
> download the appropriate <*.deb> package for R).
>
>
>
> On Wed, Oct 7, 2015 at 3:45 PM, Sasikumar Kandhasamy 
> wrote:
> > Thanks Mike. From source, i am able to compile and use R in my red hat
> linux
> > box. I was trying to get hands on using R in linux box before trying R on
> > the embedded box.
> >
> > My requirement is to run R (R scripts) on my embedded box which has
> > customized debian linux (kernel version 2.6.32) in batch mode without GUI
> > support. The embedded box have multi-core MIPS processor with nearly 30GB
> > RAM. I hope hardware resources on the embedded box shouldn't be an issue
> to
> > run R (correct me if i am wrong), but linux version running here is an
> > customized one with limited supporting services such as light weight
> shell
> > etc.
> >
> > Given this, do i need to cross compile R package for my embedded box or i
> > can directly install the debian MIPS version of R package. But there is
> no
> > apt-get or other installer in the embedded box.
> >
> >
> > Regards
> > Sasi
> >
> > On Wed, Oct 7, 2015 at 1:46 AM, Michael Hannon <
> jmhannon.ucda...@gmail.com>
> > wrote:
> >>
> >> I don't think kernel compatibility is a significant issue for most
> >> applications.  I can say for certain that I update the kernels on my
> >> linux boxes without having to reinstall R.
> >>
> >> There *are* R packages for RHEL and friends.  Have a look at:
> >>
> >> https://cran.r-project.org/bin/linux/redhat/README
> >>
> >> Note that there's a bit of fiddling required, but I don't think it's
> >> particularly complicated.
> >>
> >> It's usually not particularly difficult to install R from source.  If
> >> you prefer to do that, have a look at:
> >>
> >> https://cran.r-project.org/doc/manuals/r-release/R-admin.html
> >>
> >> Also, you don't specify your requirements, but don't overlook the
> >> possibility of installing a virtual machine on your RHEL server.
> >> (It's somewhat easier to get an R package for Fedora or Ubuntu than
> >> for RHEL, for instance.)
> >>
> >> I don't know the answer to your question about embedded systems.  I
> >> would think R would not be a great choice for an embedded system, but
> >> I don't know what your requirements are.
> >>
> >> -- Mike
> >>
> >>
> >> On Tue, Oct 6, 2015 at 9:42 PM, Sasikumar Kandhasamy  >
> >> wrote:
> >> > Thanks a lot Mike. The Linux distribution we use is "Red Hat
> Enterprise
> >> > Linux Server release 6.2".
> >> >
> >> > Also, couple of clarifications,
> >> >
> >> > 1. Do we have a R package compatibility matrix against the Linux
> kernel
> >> > version? Or for the Red Hat Linux with kernel version 2.6.32-279, do
> you
> >> > have any suggestion/recommendation on R package to be used?
> >> >
> >> > 2. If we need to use Rscripts in embedded systems such as routers and
> >> > switches, do we need to install the complete R package in the  system
> >> > also?
> >> > Or just libR.so and Rscript should be ok?
> >> >
> >> > Thanks again Mike.
> >> >
> >> > Regards
> >> > Sasi
> >> >
> >> > On Tue, Oct 6, 2015 at 5:57 PM, Michael Hannon
> >> > 
> >> > wrote:
> >> >>
> >> >> It's very likely that there is already an R package for your linux
> >> >> system, and, if so, you'd probably be well-served to use that one.
> >> >> You've given us the version of the kernel you're using (not a recent
> >> >> one, BTW), but what linux distribution are you using?
> >> >>
> >> >> -- Mike
> >> >>
> >> >>
> >> >> On Tue, Oct 6, 2015 at 3:59 PM, Sasikumar Kandhasamy
> >> >> 
> >> >> wrote:
> >> >> > Hi,
> >> >> >
> >> >> > I 

Re: [R] Installing pre-compiled R in Linux

2015-10-07 Thread Sasikumar Kandhasamy
Thanks Mike. From source, i am able to compile and use R in my red hat
linux box. I was trying to get hands on using R in linux box before trying
R on the embedded box.

My requirement is to run R (R scripts) on my embedded box which has
customized debian linux (kernel version 2.6.32) in batch mode without GUI
support. The embedded box have multi-core MIPS processor with nearly 30GB
RAM. I hope hardware resources on the embedded box shouldn't be an issue to
run R (correct me if i am wrong), but linux version running here is an
customized one with limited supporting services such as light weight shell
etc.

Given this, do i need to cross compile R package for my embedded box or i
can directly install the debian MIPS version of R package. But there is no
apt-get or other installer in the embedded box.


Regards
Sasi

On Wed, Oct 7, 2015 at 1:46 AM, Michael Hannon 
wrote:

> I don't think kernel compatibility is a significant issue for most
> applications.  I can say for certain that I update the kernels on my
> linux boxes without having to reinstall R.
>
> There *are* R packages for RHEL and friends.  Have a look at:
>
> https://cran.r-project.org/bin/linux/redhat/README
>
> Note that there's a bit of fiddling required, but I don't think it's
> particularly complicated.
>
> It's usually not particularly difficult to install R from source.  If
> you prefer to do that, have a look at:
>
> https://cran.r-project.org/doc/manuals/r-release/R-admin.html
>
> Also, you don't specify your requirements, but don't overlook the
> possibility of installing a virtual machine on your RHEL server.
> (It's somewhat easier to get an R package for Fedora or Ubuntu than
> for RHEL, for instance.)
>
> I don't know the answer to your question about embedded systems.  I
> would think R would not be a great choice for an embedded system, but
> I don't know what your requirements are.
>
> -- Mike
>
>
> On Tue, Oct 6, 2015 at 9:42 PM, Sasikumar Kandhasamy 
> wrote:
> > Thanks a lot Mike. The Linux distribution we use is "Red Hat Enterprise
> > Linux Server release 6.2".
> >
> > Also, couple of clarifications,
> >
> > 1. Do we have a R package compatibility matrix against the Linux kernel
> > version? Or for the Red Hat Linux with kernel version 2.6.32-279, do you
> > have any suggestion/recommendation on R package to be used?
> >
> > 2. If we need to use Rscripts in embedded systems such as routers and
> > switches, do we need to install the complete R package in the  system
> also?
> > Or just libR.so and Rscript should be ok?
> >
> > Thanks again Mike.
> >
> > Regards
> > Sasi
> >
> > On Tue, Oct 6, 2015 at 5:57 PM, Michael Hannon <
> jmhannon.ucda...@gmail.com>
> > wrote:
> >>
> >> It's very likely that there is already an R package for your linux
> >> system, and, if so, you'd probably be well-served to use that one.
> >> You've given us the version of the kernel you're using (not a recent
> >> one, BTW), but what linux distribution are you using?
> >>
> >> -- Mike
> >>
> >>
> >> On Tue, Oct 6, 2015 at 3:59 PM, Sasikumar Kandhasamy  >
> >> wrote:
> >> > Hi,
> >> >
> >> > I have downloaded the pre-compiled version of R package:
> >> > r-base-core(3.2.2-1) for i386 platform. Unzipped the package under my
> >> > tmp
> >> > directory (/tmp). The directories "et"c and "usr" got created with
> >> > binaries
> >> > R and Rscript under /tmp/usr/bin/.
> >> >
> >> > Executing the R (/tmp/usr/bin/R) or Rscript (/tmp/usr/bin/Rscipt)
> >> > reports
> >> > the below error,
> >> >
> >> > ./usr/bin/R
> >> >  ./usr/bin/R: line 238:
> >> > /usr/lib/R/etc/ldpaths: No such file or directory
> >> > ERROR: R_HOME ('/usr/lib/R') not found
> >> >
> >> > How to reconfigure the R environment variables? Because, i tried
> setting
> >> > the R_HOME directory to "/tmp/usr/lib/R" but still not working.
> >> >
> >> > The Linux version i am using is  2.6.32. Please help me with the steps
> >> > to
> >> > install the R correctly. Thanks.
> >> >
> >> > Regards
> >> > Sasi
> >> >
> >> > [[alternative HTML version deleted]]
> >> >
> >> > __
> >> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> > https://stat.ethz.ch/mailman/listinfo/r-help
> >> > PLEASE do read the posting guide
> >> > http://www.R-project.org/posting-guide.html
> >> > and provide commented, minimal, self-contained, reproducible code.
> >
> >
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Error with Segmented package

2015-10-07 Thread andrew haywood
Thanks David,

I apologies for not posting the versions.

I am running

R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] segmented_0.5-1.2

And I still get the error. What is the best way to debug the error?

Kind regards
Andrew


On Thu, Oct 8, 2015 at 7:11 AM, David Winsemius 
wrote:

>
> On Oct 7, 2015, at 6:50 AM, andrew haywood wrote:
>
> > Dear List,
> >
> > I am trying to run a simple pieewise regression using the segmented
> package.
> >
> > When running the following code
> >
> > library(segmented)
> > data = data.frame(x=c(50,60,70,80,90,100,110) , y=
> > c(703.786,705.857,708.153,711.056,709.257, 707.4, 705.6))
> >
> > model.lm = segmented(lm(y~x,data = data),seg.Z = ~x, psi = NA, control =
> > seg.control(K=1))
> >
> > I get the following error.
> >
> > Error in if (psi == Inf) psi <- median(XREGseg) :
> >  missing value where TRUE/FALSE needed
>
> I don't get any error, despite being a bit behind the times. You need to
> specify the versions (OS, R, segmented) and prepare for some debugging
> efforts. Easiest way to do this is with the output of sessionInfo().
>
> R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut"
> Copyright (C) 2015 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>
> I also have an embarrassing number of packages loaded.
>
> other attached packages:
>  [1] segmented_0.5-1.1   boot_1.3-17 sqldf_0.4-10
>
> (remaining 48 are omitted)
>
>
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius
> Alameda, CA, USA
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] additive proportional odds model in R

2015-10-07 Thread David Winsemius

On Oct 7, 2015, at 3:33 AM, Neverstop wrote:

> Hi all!
> I'm looking for a way to fit an additive proportional odds model in R since
> I need to analyse ordinal data. 
> The polr() function of the MASS package of R allows only to fit a linear
> proportional odds model so I can't use it. 

Can you explain the additional requirements you understand for your request. 
The polr function is additive on the log-odds scale.

> The gam() function of the gam package of R allows to fit additive models and
> generalized additive models. This package uses smoothing splines and loess
> as smoothers. I've read the documentation and it doesn't seem to be possible
> to fit an additive proportional odds model in R.  

Are you looking for an identity link with binomial errors? 

> Do you know which function should I use?

I doubt that it would allow a identity link, but the `lrm` function in 
`pkg:rms` is also used for ordinal proportional odds models. It supports 
several spline representations of functional form.


> Thank you in advance.
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/additive-proportional-odds-model-in-R-tp4713259.html
> Sent from the R help mailing list archive at Nabble.com.

I think you should understand that Nabble postings to R-help will soon not be 
allowed.

> __   So you _should_ read
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

-- 

David Winsemius
Alameda, CA, USA

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Error with Segmented package

2015-10-07 Thread David Winsemius

On Oct 7, 2015, at 6:10 PM, andrew haywood wrote:

> Thanks David, 
> 
> I apologies for not posting the versions.
> 
> I am running
> 
> R version 3.2.2 (2015-08-14)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 7 x64 (build 7601) Service Pack 1
> 
> locale:
> [1] LC_COLLATE=English_United Kingdom.1252 
> [2] LC_CTYPE=English_United Kingdom.1252   
> [3] LC_MONETARY=English_United Kingdom.1252
> [4] LC_NUMERIC=C   
> [5] LC_TIME=English_United Kingdom.1252
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base 
> 
> other attached packages:
> [1] segmented_0.5-1.2
> 
> And I still get the error. What is the best way to debug the error?

The first thing I do is run traceback() immediately after the error. If that 
fails to illuminate the problem, my next step is falling back to:

options(error="browser") 
# which should allow you to examine the system-state at the time of the error.

And at that point I start considering sending an email to the maintainer with 
my reproducible example, especially so since it fails with a more recent 
version. It may be that the maintainer has the same OS as you have.

-- 
David.
> 
> Kind regards teht
> Andrew
> 
> 
> On Thu, Oct 8, 2015 at 7:11 AM, David Winsemius  
> wrote:
> 
> On Oct 7, 2015, at 6:50 AM, andrew haywood wrote:
> 
> > Dear List,
> >
> > I am trying to run a simple pieewise regression using the segmented package.
> >
> > When running the following code
> >
> > library(segmented)
> > data = data.frame(x=c(50,60,70,80,90,100,110) , y=
> > c(703.786,705.857,708.153,711.056,709.257, 707.4, 705.6))
> >
> > model.lm = segmented(lm(y~x,data = data),seg.Z = ~x, psi = NA, control =
> > seg.control(K=1))
> >
> > I get the following error.
> >
> > Error in if (psi == Inf) psi <- median(XREGseg) :
> >  missing value where TRUE/FALSE needed
> 
> I don't get any error, despite being a bit behind the times. You need to 
> specify the versions (OS, R, segmented) and prepare for some debugging 
> efforts. Easiest way to do this is with the output of sessionInfo().
> 
> R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut"
> Copyright (C) 2015 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin10.8.0 (64-bit)
> 
> I also have an embarrassing number of packages loaded.
> 
> other attached packages:
>  [1] segmented_0.5-1.1   boot_1.3-17 sqldf_0.4-10
> 
> (remaining 48 are omitted)
> 
> 
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
> David Winsemius
> Alameda, CA, USA
> 
> 

David Winsemius
Alameda, CA, USA

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] duplicate rows with rbind in a loop

2015-10-07 Thread Cara Fiore
Dear R users,

I wrote a simple script to change the header lines in a fasta file that
contains DNA sequences in a format:

>header1
sequence1
>header2
sequence2

I am basically trying to replace the "header" in this file with a line from
another file (taxonomy file). In order to do that I have to find the
matching header in the taxonomy file.

The output should be in fasta format and it is, but the rows repeat so the
output file is huge and it looks like:

>header1
sequence1
>header1
sequence1
>header2
sequence2

The code I have is:

tax=read.table("taxonomy_file.txt", header=F, quote="", sep="\t")
tax2=data.frame(tax)

library("Biostrings")
seqs=readDNAStringSet("File.fasta")
header=names(seqs)
seqs2=paste(seqs)

new.final=NULL
i=1

#Go through tax file and match the header in tax file to header in seqs file
for(i in 1:length(tax[,1])){
  sampleID=NULL
  match=NULL
  sampleID=as.character(tax2[i,1])  #sample ID in taxonomy header
  match=which(sampleID==header) #index for match in header file
  if(match>0){
newH1=NULL
newH2=NULL
seqline=NULL
new.header=NULL
newH1=as.character(tax2[i,1])
newH2=as.character(tax2[i,2])
seqline=seqs2[match]
new.header=paste(">",newH1,"|",newH2, sep="")
new.final=rbind(new.final, new.header, seqline)
  }
  print(paste("percent complete =", round((i/length(tax2[,1]))*100,3),
"%",sep=" "))
  write.table(new.final, file="Test_output.txt", quote=FALSE, sep="\n",
col.names=FALSE, row.names=FALSE, append=TRUE)
  i=i+1
}


Something about rbind is repeating all of the rows every time it writes to
the output file. I have not been able to find anything about this online or
in the r help for rbind, although perhaps I am missing something obvious
about this.

I greatly appreciate any help with this!

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] [lattice::xyplot] Using (panel:.)abline with panel.superpose?

2015-10-07 Thread Duncan Mackay
Forgot to send to list

-Original Message-
From: Duncan Mackay [mailto:dulca...@bigpond.com] 
Sent: Thursday, 8 October 2015 08:44
To: 'Szumiloski, John'
Subject: RE: [R] [lattice::xyplot] Using (panel:.)abline with
panel.superpose?

Hi John

I only got grid lines on your # code 2 with same lattice version on win 7
and blank for the first code

Try

xyplot(Y~X|Trt, data=dat,
   groups=Sbj,
   type='b',
   lty=1,
   cex=2,
   lwd=3,
   scales=list(x=list(at=xgrid), y=list(at=ygrid)),
   col=c('red', 'blue'),
   pch=c(16,17),
   panel= panel.superpose,
   panel.groups = function(x,y, ...){

panel.abline(h=ygrid, v=xgrid, col = gray(0.9) )

panel.xyplot(x,y, ...)

  }# panel
) # xyplot

It produces grid lines over the lines and points so one way around it is to
use alpha settings.
Not all devices will accept alpha.

xyplot(Y~X|Trt, data=dat,
   groups=Sbj,
   type='b',
   lty=1,
   cex=2,
   lwd=3,
   alpha = 1,
   scales=list(x=list(at=xgrid), y=list(at=ygrid)),
   col=c('red', 'blue'),
   pch=c(16,17),
   panel= panel.superpose,
   panel.groups = function(x,y,alpha, ...){

panel.abline(h=ygrid, v=xgrid, col=1, alpha = 0.1)

panel.xyplot(x,y, alpha = 1, ...)
   
  }# panel
) # xyplot

If you use par.settings it will give correct colours lines etc to auto key

xyplot(Y~X|Trt, data=dat,
   groups=Sbj,
   type='b',
   par.settings = list(strip.background = list(col = "transparent"),
   superpose.line = list(col = c('red', 'blue'),
 alpha = 1,
 lty=1,lwd=3),
   superpose.symbol = list(col=c('red', 'blue'),
   alpha = 1,
   pch=c(16,17),
   cex=2)),
   scales=list(x=list(at=xgrid), y=list(at=ygrid)),
 auto.key = T,
   panel= panel.superpose,
   panel.groups = function(x,y,alpha, ...){

panel.abline(h=ygrid, v = xgrid, col=1, alpha = 0.1)

panel.xyplot(x,y, alpha = 1, ...)

  }# panel
) # xyplot

Regards

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 [mailto:r-help-boun...@r-project.org] On Behalf Of Szumiloski,
John
Sent: Thursday, 8 October 2015 03:40
To: r-help@r-project.org
Subject: [R] [lattice::xyplot] Using (panel:.)abline with panel.superpose?

Dear useRs,

I recently had a query concerning how to customize the graphics parameters
in lattice::xyplot to change not only the color but also the pch symbols,
lty and lwd line parameters, etc., within each grouping variable in the
plot.  (https://stat.ethz.ch/pipermail/r-help/2015-July/430285.html).  Many
thanks to Mark Leeds who described the solution using panel.superpose as the
panel function and defining a custom panel.groups function using the
subscripts argument.

Here is a crude example.  Note how the pch parameter varies with grouping
variable as well as color.  I have commented out two lines which are not
important for the example but are for my main question.

 begin code 1

# R version 3.2.2 release, lattice version 0.20-33, Windows 7.

dat <- data.frame(Trt=rep(c('1','2'), each=10),
  Sbj=rep(c('1','2'), each=5),
  X=rep(c(0,1,2,3,4), times=4),
  Y=c(1,3,3,3,1, 2,4,4,4,2,
  3,1,1,1,3, 4,2,2,2,4)
 )

xgrid <- seq(0L, 4L)
ygrid <- seq(0L, 5L)

require(lattice)
xyplot(Y ~ X | Trt, data=dat, groups=Sbj, type='b', lty=1, cex=2, lwd=3,
   scales=list(x=list(at=xgrid), y=list(at=ygrid)),
   ### abline=list(h=ygrid, v=xgrid, col=gray(0.8)),
   mycol=c('red', 'blue'), mypch=c(16,17),
   panel=panel.superpose,
   panel.groups=function(x, y, subscripts,
  mycol, mypch, col.line, col.symbol, pch,
...) {
 ### panel.abline(h=ygrid, v=xgrid,
col=gray(0.8))
 panel.xyplot(x, y, ...,
 pch =
mypch[dat[['Sbj']][subscripts]],
  col.symbol =
mycol[dat[['Sbj']][subscripts]],
col.line =
mycol[dat[['Sbj']][subscripts]]
 )
} # function
  ) # xyplot

### end code 1

My question involves the commented out lines.  I would like to draw 

[R] Time Series Daily Frequency Part of a Year

2015-10-07 Thread zod jones
My data consist of daily sales figures for multiple products but only for a
3 month period each year (Oct., Nov., Dec). The goal is to forecast the
daily sales figures for the following year *by day* (the following Oct.,
Nov., Dec.) So, I'd like to forecast what sales for product X will be on
Nov. 12th of the next year (and each day of those three months), for
example.

I am just conceptually stuck on the fact that the time series is "yearly"
in one sense but the daily observations only occur for those 3 months. The
rest of the year is not really 0 -- the products are not even for sale the
rest of the year (these are tickets for events). The frequency seems like
it should be 92 days.

Hoping someone can just point me in the right direction conceptually.

Thanks,

Zodran

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Installing pre-compiled R in Linux

2015-10-07 Thread peter dalgaard

On 07 Oct 2015, at 13:05 , Jeroen Ooms  wrote:

>> On Tue, Oct 6, 2015 at 9:42 PM, Sasikumar Kandhasamy  
>> wrote:
>>> Thanks a lot Mike. The Linux distribution we use is "Red Hat Enterprise
>>> Linux Server release 6.2".
> 
> On RHEL and CentOS the easiest and most reliable way to get R and R
> packages is via EPEL. Simply add the EPEL repositories and from there
> on you can install R and R packages as you would do on Fedora.
> 

Pretty much no Linux distribution expects you to install anything by "unzipping 
compiled code". They generally have a packaging format like .rpm or .deb, and 
even then you can't mix them freely between different distributions -- SUSE 
.rpm are usually not interchangeable with RedHat and vice versa. You generally 
access them from curated package repositories using tools like yum or apt-get. 
One exception may be Slackware. At any rate, whereever you got your zipfile 
from, it is most likely wrong for RHEL.


-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Installing pre-compiled R in Linux

2015-10-07 Thread Jeroen Ooms
> On Tue, Oct 6, 2015 at 9:42 PM, Sasikumar Kandhasamy  
> wrote:
>> Thanks a lot Mike. The Linux distribution we use is "Red Hat Enterprise
>> Linux Server release 6.2".

On RHEL and CentOS the easiest and most reliable way to get R and R
packages is via EPEL. Simply add the EPEL repositories and from there
on you can install R and R packages as you would do on Fedora.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Measure the frequencies of pairs in a matrix

2015-10-07 Thread Boris Steipe
Still not sure I understand. But here is what I think you might mean:

# Your data
mat <- structure(c(5, 6, 5, 5, 4, 3, 6, 7, 4, 7, 5, 5, 5, 5, 6, 5, 5,
4, 3, 6, 7, 4, 7, 5, 5, 5, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7,
6, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7, 6), .Dim = c(26L, 2L))

# Create a square matrix with enough space to have an element for each pair. 
Since
# order is not important, only the upper triangle is used. If the matrix is
# large and sparse, a different approach might be needed.
freq <- matrix(numeric(max(mat) * max(mat)),  nrow = max(mat), ncol = max(mat))

# Loop over your input
for (i in 1:nrow(mat)) {
# Sort the elements of a row by size.
x <- sort(mat[i,])
# Increment the corresponding element of the frequency matrix
freq[x[1], x[2]] <- freq[x[1], x[2]] + 1
}

freq


Cheers,
B.
 




On Oct 7, 2015, at 1:17 AM, Hermann Norpois  wrote:

> Ok, this was misleading. And was not that important. My result matrix should 
> look like this: 
> 
>   12   3   4   5   6   7 ...
> 1 p1 p2
> 2 p
> 3
> 4
> 
> p1 etc are the frequencies of the combinations
> 
> 1 and 2 for instance do not appear in my example. So the values would be 
> zero. Actually, this part is not too important. I would be happy enough to 
> solve the challenge with the frequencies of the pairs.
> Thanks Hermann
> 
> 2015-10-07 2:40 GMT+02:00 Boris Steipe :
> Since order is not important to you, you can order your pairs (e.g. 
> decreasing) before compiling the frequencies.
> But I don't understand the second part about values "that do not appear in 
> the matrix". Do you mean you want to assess all combinations? If that's the 
> case I would think about a hash table or other indexed data structure, rather 
> than iterating through a matrix.
> 
> 
> B.
> 
> 
> 
> On Oct 6, 2015, at 4:59 PM, Hermann Norpois  wrote:
> 
> > Hello,
> >
> > I have a matrix mat (see dput(mat))
> >
> >> mat
> >  [,1] [,2]
> > [1,]56
> > [2,]65
> > [3,]54
> > [4,]55
> > 
> >
> > I want the frequencies of the pairs in a new matrix, whereas the
> > combination 5 and 6 is the same as 6 and 5 (see the first two rows of mat).
> > In other words: What is the probability of each combination (each row)
> > ignoring the order in the combination. As a result I would like to have a
> > matrix that includes rows and cols 0, 1, 2 ... max (mat) that do not appear
> > in my matrix.
> >
> > dput (mat)
> > structure(c(5, 6, 5, 5, 4, 3, 6, 7, 4, 7, 5, 5, 5, 5, 6, 5, 5,
> > 4, 3, 6, 7, 4, 7, 5, 5, 5, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7,
> > 6, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7, 6), .Dim = c(26L, 2L))
> >
> > Thanks
> > Hermann
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] vector graphics

2015-10-07 Thread Ivan Calandra
For the record, it seems that devEMF::emf() works fine on the Windows 
Vista SP2 machine with R3.2.2 and Illustrator CS4: the text is 
recognized as text and every point/line can be dissociated.


Ivan

--
Ivan Calandra, PhD
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.fr
https://www.researchgate.net/profile/Ivan_Calandra

Le 07/10/15 10:05, Ivan Calandra a écrit :

Thanks Jean for the tip.
I'll try postscript() and devEMF::emf() and see if it works.
Still, it's very complicated to export vector graphics in R...

Ivan

--
Ivan Calandra, PhD
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.fr
https://www.researchgate.net/profile/Ivan_Calandra

Le 07/10/15 00:16, Adams, Jean a écrit :
Perhaps the discussion at this link will be helpful ... 
http://stackoverflow.com/questions/9555889/producing-a-vector-graphics-image-i-e-metafile-in-r-suitable-for-printing-in


Jean

On Tue, Oct 6, 2015 at 9:42 AM, Ivan Calandra 
> 
wrote:


Dear useRs,

A colleague of mine is having a problem with graphic devices. The
goal is to save into a vector graphic format that can be edited
with Illustrator CS4.

On my Mac (Snow Leopard), I use RSvgDevice::devSVG() and it works
fine.
But on her Windows Vista computer, I cannot find an alternative.>
sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows Vista (build 6002) Service Pack 2

I have tried:
- pdf(): I cannot dissociate the graphical elements (no problem
with text)
- cairo_pdf(): the text is replaced by symbols
- cairo_ps(): fine except that the text is not text but object (it
is then a bit troublesome, as any text modification requires the
text to be completely rewritten)
- svg(): the graphic is completely screwed up (it seems to be a
scaling problem, with symbols and letters all very large and
superposed)
- RSvgDevice cannot be installed on the Windows machine, neither
as binary nor from source.

Is there any other device that could work? If not, is it a matter
of settings? So, basically, what can I do?

Thank you in advance,
Ivan

-- Ivan Calandra, PhD
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.fr 
https://www.researchgate.net/profile/Ivan_Calandra

__
R-help@r-project.org  mailing list --
To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.






__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] F-test of equality of variances - but weighted?

2015-10-07 Thread Dimitri Liakhovitski
I would like to use an F-Test for Equality of Variances on a variable
to compare two groups. Normally, this would be done with 'var.test'.
However, the data need to be weighted (individual-level weights).

R's package 'survey' is geared at running analyses with complex
sampling weights. But, unless I have overlooked something, it doesn't
seem able to do an F-test for Equality of Variances (or a similar
test) on weighted data.

Any pointers what to do in this situation?

Or should I simply calculate weighted variances for both groups, sd1
and sd2 and say:
F = var1/var2
With df's of weighted n1-1 for group 1 and weighted n2-1 for group 2?

Would it be kosher from statistical perspective?


Thanks a lot!

-- 
Dimitri Liakhovitski

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Installing different R versions

2015-10-07 Thread Wolfgang Raffelsberger
check out the official document
*R Installation and Administration*
from https://cran.r-project.org/manuals.html
There you'll find how to define a specific path for each installation.

(Since a number of years I administrate multiple versions of R at different
platforms, of course including Linux)

Wolfgang

2015-10-07 9:04 GMT+02:00 Loris Bennett :

> Dear Luca,
>
> Luca Cerone  writes:
>
> > Dear all,
> > on one shared machine we have an older R version installed. Some packages
> > have known issues with that version that are fixed in newer R versions.
> >
> > Since that is a production machine with many jobs running we would like
> to
> > keep things as they are. However I would also like to keep advantage of
> the
> > newest version and the bug fixes introduced.
> >
> > What would be the best way to install a newer version along the one that
> > already exists? Is it possible to install it for a specific user only?
> >
> > Cheers,
> > Luca
>
> If you are on a Unix-like platform, a standard way of dealing with
> multiple versions of a piece of software installed in parallel is
> "Environment Modules":
>
> http://modules.sourceforge.net/
>
> Packages for various Linux distributions are available.
>
> You could make a version available for a specific user by setting
> appropriate file permissions of the module file which is used to set up
> the environment.  However, I would consider this a somewhat unusual
> configuration.  If you are worried about people using the wrong version
> by mistake, you can either have the standard version available without
> using modules, or you can define a default version within the modules
> setup.
>
> HTH
>
> Loris
>
> --
> This signature is currently under construction.
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Installing pre-compiled R in Linux

2015-10-07 Thread stephen sefick
I couldn't tell from the OP's message what distribution they have
installed. If it is redhat (or a derivative), the extra packages for
enterprise linux (epel) has up-to-date R packages to install with yum. I
have had some minor issues with installing A FEW (mostly GIS related)
packages that were easily solved with google and careful reading of the
error messages.
HTH,

Stephen

On Wed, Oct 7, 2015 at 6:32 AM, peter dalgaard  wrote:

>
> On 07 Oct 2015, at 13:05 , Jeroen Ooms  wrote:
>
> >> On Tue, Oct 6, 2015 at 9:42 PM, Sasikumar Kandhasamy 
> wrote:
> >>> Thanks a lot Mike. The Linux distribution we use is "Red Hat Enterprise
> >>> Linux Server release 6.2".
> >
> > On RHEL and CentOS the easiest and most reliable way to get R and R
> > packages is via EPEL. Simply add the EPEL repositories and from there
> > on you can install R and R packages as you would do on Fedora.
> >
>
> Pretty much no Linux distribution expects you to install anything by
> "unzipping compiled code". They generally have a packaging format like .rpm
> or .deb, and even then you can't mix them freely between different
> distributions -- SUSE .rpm are usually not interchangeable with RedHat and
> vice versa. You generally access them from curated package repositories
> using tools like yum or apt-get. One exception may be Slackware. At any
> rate, whereever you got your zipfile from, it is most likely wrong for RHEL.
>
>
> --
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Office: A 4.23
> Email: pd@cbs.dk  Priv: pda...@gmail.com
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Stephen Sefick
**
Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849
**
sas0...@auburn.edu
http://www.auburn.edu/~sas0025
**

Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods.  We are mammals, and have not exhausted the annoying little
problems of being mammals.

-K. Mullis

"A big computer, a complex algorithm and a long time does not equal
science."

  -Robert Gentleman

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Measure the frequencies of pairs in a matrix

2015-10-07 Thread David L Carlson
As with Boris, I'm not sure what you are looking for, but this may help

> # To get all possibilities, create a grid
> grd <- expand.grid(0:9, 0:9)
> # Extract those with smaller first column values
> grd <- grd[grd$Var1 <= grd$Var2,]
> # Tabulate after pasting first and second column
> grd2 <- data.frame(table(apply(grd, 1, paste0, collapse=" - ")))
> 
> # Combine the two tables and subtract 1 to get rid of the counts from 
> grd2$Freq
> dta2 <- rbind(grd2, dta)
> freqs <- data.frame(xtabs(Freq~Var1, dta2) - 1)
> str(freqs)
'data.frame':   55 obs. of  2 variables:
 $ Var1: Factor w/ 55 levels "0 - 0","0 - 1",..: 1 2 3 4 5 6 7 8 9 10 ...
 $ Freq: num  0 0 0 0 0 0 0 0 0 0 ...
> freqs[c(40:50), ]
Var1 Freq
40 4 - 90
41 5 - 52
42 5 - 6   10
43 5 - 74
44 5 - 80
45 5 - 90
46 6 - 60
47 6 - 72
48 6 - 80
49 6 - 90
50 7 - 70

-
David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77840-4352

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Boris Steipe
Sent: Wednesday, October 7, 2015 8:10 AM
To: Hermann Norpois
Cc: r-help
Subject: Re: [R] Measure the frequencies of pairs in a matrix

Still not sure I understand. But here is what I think you might mean:

# Your data
mat <- structure(c(5, 6, 5, 5, 4, 3, 6, 7, 4, 7, 5, 5, 5, 5, 6, 5, 5,
4, 3, 6, 7, 4, 7, 5, 5, 5, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7,
6, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7, 6), .Dim = c(26L, 2L))

# Create a square matrix with enough space to have an element for each pair. 
Since
# order is not important, only the upper triangle is used. If the matrix is
# large and sparse, a different approach might be needed.
freq <- matrix(numeric(max(mat) * max(mat)),  nrow = max(mat), ncol = max(mat))

# Loop over your input
for (i in 1:nrow(mat)) {
# Sort the elements of a row by size.
x <- sort(mat[i,])
# Increment the corresponding element of the frequency matrix
freq[x[1], x[2]] <- freq[x[1], x[2]] + 1
}

freq


Cheers,
B.





On Oct 7, 2015, at 1:17 AM, Hermann Norpois  wrote:

> Ok, this was misleading. And was not that important. My result matrix should 
> look like this: 
> 
>   12   3   4   5   6   7 ...
> 1 p1 p2
> 2 p
> 3
> 4
> 
> p1 etc are the frequencies of the combinations
> 
> 1 and 2 for instance do not appear in my example. So the values would be 
> zero. Actually, this part is not too important. I would be happy enough to 
> solve the challenge with the frequencies of the pairs.
> Thanks Hermann
> 
> 2015-10-07 2:40 GMT+02:00 Boris Steipe :
> Since order is not important to you, you can order your pairs (e.g. 
> decreasing) before compiling the frequencies.
> But I don't understand the second part about values "that do not appear in 
> the matrix". Do you mean you want to assess all combinations? If that's the 
> case I would think about a hash table or other indexed data structure, rather 
> than iterating through a matrix.
> 
> 
> B.
> 
> 
> 
> On Oct 6, 2015, at 4:59 PM, Hermann Norpois  wrote:
> 
> > Hello,
> >
> > I have a matrix mat (see dput(mat))
> >
> >> mat
> >  [,1] [,2]
> > [1,]56
> > [2,]65
> > [3,]54
> > [4,]55
> > 
> >
> > I want the frequencies of the pairs in a new matrix, whereas the
> > combination 5 and 6 is the same as 6 and 5 (see the first two rows of mat).
> > In other words: What is the probability of each combination (each row)
> > ignoring the order in the combination. As a result I would like to have a
> > matrix that includes rows and cols 0, 1, 2 ... max (mat) that do not appear
> > in my matrix.
> >
> > dput (mat)
> > structure(c(5, 6, 5, 5, 4, 3, 6, 7, 4, 7, 5, 5, 5, 5, 6, 5, 5,
> > 4, 3, 6, 7, 4, 7, 5, 5, 5, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7,
> > 6, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7, 6), .Dim = c(26L, 2L))
> >
> > Thanks
> > Hermann
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [lattice::xyplot] Using (panel:.)abline with panel.superpose?

2015-10-07 Thread Szumiloski, John
Dear useRs,

I recently had a query concerning how to customize the graphics parameters in 
lattice::xyplot to change not only the color but also the pch symbols, lty and 
lwd line parameters, etc., within each grouping variable in the plot.  
(https://stat.ethz.ch/pipermail/r-help/2015-July/430285.html).  Many thanks to 
Mark Leeds who described the solution using panel.superpose as the panel 
function and defining a custom panel.groups function using the subscripts 
argument.

Here is a crude example.  Note how the pch parameter varies with grouping 
variable as well as color.  I have commented out two lines which are not 
important for the example but are for my main question.

 begin code 1

# R version 3.2.2 release, lattice version 0.20-33, Windows 7.

dat <- data.frame(Trt=rep(c('1','2'), each=10),
  Sbj=rep(c('1','2'), each=5),
  X=rep(c(0,1,2,3,4), times=4),
  Y=c(1,3,3,3,1, 2,4,4,4,2,
  3,1,1,1,3, 4,2,2,2,4)
 )

xgrid <- seq(0L, 4L)
ygrid <- seq(0L, 5L)

require(lattice)
xyplot(Y ~ X | Trt, data=dat, groups=Sbj, type='b', lty=1, cex=2, lwd=3,
   scales=list(x=list(at=xgrid), y=list(at=ygrid)),
   ### abline=list(h=ygrid, v=xgrid, col=gray(0.8)),
   mycol=c('red', 'blue'), mypch=c(16,17),
   panel=panel.superpose,
   panel.groups=function(x, y, subscripts,
  mycol, mypch, col.line, col.symbol, pch, ...) 
{
 ### panel.abline(h=ygrid, v=xgrid, 
col=gray(0.8))
 panel.xyplot(x, y, ...,
 pch = 
mypch[dat[['Sbj']][subscripts]],
  col.symbol = 
mycol[dat[['Sbj']][subscripts]],
col.line = 
mycol[dat[['Sbj']][subscripts]]
 )
} # function
  ) # xyplot

### end code 1

My question involves the commented out lines.  I would like to draw a light 
grid in the panels.  If I used panel.grid() it would be impossible to get the 
gridlines into arbitrary positions, as it seems to pick values similar to 
pretty() (I would love to be corrected on this).  So we can use an abline 
argument to the main xyplot call, or a panel.abline() call in the panel.groups 
function.

But either way leads to a problem.  The ablines seem to be rerendered for each 
level of the grouping variable, thus only the final level is plotted without 
being the grid rendered on top of it.  Try it by uncommenting either line.

This is not totally surprising as it does mention somewhere in the 
documentation that panel.groups() is called for each value of the grouping 
variable.  So my question: How do I render the grid just once, before actually 
rendering the data, so as to avoid this problem?

I realized a good place to start might be to include panel.abline in the panel 
function itself, rather in the panel.groups function called several times per 
panel.  Thus something like this:

### begin code 2

xyplot(Y~X|Trt, data=dat, groups=Sbj, type='b', lty=1, cex=2, lwd=3,
   scales=list(x=list(at=xgrid), y=list(at=ygrid)),
   mycol=c('red', 'blue'), mypch=c(16,17),
   panel=function(x, y, ...) {   ##  < new 
panel function
  panel.abline(h=ygrid, v=xgrid, col=gray(0.9))
  panel.superpose(x, y, ...)
 },
   panel.groups=function(x, y, subscripts,
  mycol, mypch, col.line, col.symbol, pch, ...) 
{
 panel.xyplot(x, y, ...,
 pch = 
mypch[dat[['Sbj']][subscripts]],
  col.symbol = 
mycol[dat[['Sbj']][subscripts]],
col.line = 
mycol[dat[['Sbj']][subscripts]]
 )
} # function
  ) # xyplot

### end code 2

Of course this won't work as written, I need to replace the ... arguments with 
the right ones.  Here is where I am having trouble.  I have tried all kinds of 
permutations of the mycol etc., xgrid etc., subscripts etc., and never got the 
plot to render the ablines once, then the data correctly.

Any assistance greatly appreciated.
John
John Szumiloski, Ph.D.
Principal Scientist, Statistician
Analytical and Bioanalytical Development
NBR105-1-1411

Bristol-Myers Squibb
P.O. Box 191
1 Squibb Drive
New Brunswick, NJ
08903-0191
USA

(732) 227-7167




 This message (including any attachments) may contain co...{{dropped:8}}

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and 

Re: [R] Measure the frequencies of pairs in a matrix

2015-10-07 Thread William Dunlap
You could also call table() on the columns of the input matrix, first
converting them
to factors with levels 1:max.  Then add together the upper and lower
triangles of
the table if order is not important.  E.g.,
f2 <- function (mat)
{
maxMat <- max(mat)
stopifnot(is.matrix(mat), all(mat %in% seq_len(maxMat)))
L <- split(factor(mat, levels = seq_len(maxMat)), col(mat))
Table <- do.call(table, unname(L))
ignoreOrder <- function(M) {
stopifnot(length(dim(M)) == 2)
lower <- lower.tri(M, diag = FALSE)
upper <- upper.tri(M, diag = FALSE)
M[lower] <- M[lower] + t(M)[lower]
M[upper] <- t(M)[upper]
M
}
ignoreOrder(Table)
}

> mat <- structure(c(5, 6, 5, 5, 4, 3, 6, 7, 4, 7, 5, 5, 5, 5, 6, 5, 5,
4, 3, 6, 7, 4, 7, 5, 5, 5, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7,
6, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7, 6), .Dim = c(26L, 2L))
> f2(mat)

 1  2  3  4  5  6  7
  1  0  0  0  0  0  0  0
  2  0  0  0  0  0  0  0
  3  0  0  0  2  0  0  2
  4  0  0  2  0  4  0  0
  5  0  0  0  4  2 10  4
  6  0  0  0  0 10  0  2
  7  0  0  2  0  4  2  0
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Wed, Oct 7, 2015 at 6:09 AM, Boris Steipe  wrote:
> Still not sure I understand. But here is what I think you might mean:
>
> # Your data
> mat <- structure(c(5, 6, 5, 5, 4, 3, 6, 7, 4, 7, 5, 5, 5, 5, 6, 5, 5,
> 4, 3, 6, 7, 4, 7, 5, 5, 5, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7,
> 6, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7, 6), .Dim = c(26L, 2L))
>
> # Create a square matrix with enough space to have an element for each pair. 
> Since
> # order is not important, only the upper triangle is used. If the matrix is
> # large and sparse, a different approach might be needed.
> freq <- matrix(numeric(max(mat) * max(mat)),  nrow = max(mat), ncol = 
> max(mat))
>
> # Loop over your input
> for (i in 1:nrow(mat)) {
> # Sort the elements of a row by size.
> x <- sort(mat[i,])
> # Increment the corresponding element of the frequency matrix
> freq[x[1], x[2]] <- freq[x[1], x[2]] + 1
> }
>
> freq
>
>
> Cheers,
> B.
>
>
>
>
>
> On Oct 7, 2015, at 1:17 AM, Hermann Norpois  wrote:
>
>> Ok, this was misleading. And was not that important. My result matrix should 
>> look like this:
>>
>>   12   3   4   5   6   7 ...
>> 1 p1 p2
>> 2 p
>> 3
>> 4
>>
>> p1 etc are the frequencies of the combinations
>>
>> 1 and 2 for instance do not appear in my example. So the values would be 
>> zero. Actually, this part is not too important. I would be happy enough to 
>> solve the challenge with the frequencies of the pairs.
>> Thanks Hermann
>>
>> 2015-10-07 2:40 GMT+02:00 Boris Steipe :
>> Since order is not important to you, you can order your pairs (e.g. 
>> decreasing) before compiling the frequencies.
>> But I don't understand the second part about values "that do not appear in 
>> the matrix". Do you mean you want to assess all combinations? If that's the 
>> case I would think about a hash table or other indexed data structure, 
>> rather than iterating through a matrix.
>>
>>
>> B.
>>
>>
>>
>> On Oct 6, 2015, at 4:59 PM, Hermann Norpois  wrote:
>>
>> > Hello,
>> >
>> > I have a matrix mat (see dput(mat))
>> >
>> >> mat
>> >  [,1] [,2]
>> > [1,]56
>> > [2,]65
>> > [3,]54
>> > [4,]55
>> > 
>> >
>> > I want the frequencies of the pairs in a new matrix, whereas the
>> > combination 5 and 6 is the same as 6 and 5 (see the first two rows of mat).
>> > In other words: What is the probability of each combination (each row)
>> > ignoring the order in the combination. As a result I would like to have a
>> > matrix that includes rows and cols 0, 1, 2 ... max (mat) that do not appear
>> > in my matrix.
>> >
>> > dput (mat)
>> > structure(c(5, 6, 5, 5, 4, 3, 6, 7, 4, 7, 5, 5, 5, 5, 6, 5, 5,
>> > 4, 3, 6, 7, 4, 7, 5, 5, 5, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7,
>> > 6, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7, 6), .Dim = c(26L, 2L))
>> >
>> > Thanks
>> > Hermann
>> >
>> >   [[alternative HTML version deleted]]
>> >
>> > __
>> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide 
>> > http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide