Re: [R] [FORGED] lattice: control panel extent on device

2016-10-25 Thread Richard M. Heiberger
I think this is simpler.

vol_p2 <- vol_p
vol_p2$legend <- NULL
print(update(vol_p2, scales=list(y=list(labels=FALSE))), split = c(1,
2, 1, 2), more = TRUE)
draw.colorkey(vol_p$legend$right$args$key, draw=TRUE,
vp=viewport(y=.27, height=.26, x=.75))
print(update(xy_p, scales=list(y=list(labels=FALSE))),  split = c(1,
1, 1, 2), more = FALSE)

On Tue, Oct 25, 2016 at 10:08 PM, Ben Tupper  wrote:
> Wow!  That's exactly what I am looking for!
>
> I have had both books* open in front of me all day to no avail, and, I was 
> spinning round and round - I was waaay off in left field.
>
> Thanks so much!
> Ben
>
>
> * https://www.r-project.org/doc/bib/R-books_bib.html#R:Sarkar:2008
>   https://www.r-project.org/doc/bib/R-books_bib.html#R:Murrell:2011
>
>> On Oct 25, 2016, at 8:07 PM, Paul Murrell  wrote:
>>
>> Hi
>>
>> This might work, though it's a teensy bit more complicated and a bit manual 
>> (on the left axis labels) and it ignores heights and vertical whitespace ...
>>
>> library(lattice)
>> d <- dim(volcano)
>> xy <- data.frame(x = 1:d[1], y = volcano[,30] )
>> library(grid)
>> grid.newpage()
>> pushViewport(viewport(y=0, height=.5, just="bottom"))
>> # Force identical widths where we can
>> layout.widths <- lattice.options("layout.widths")[[1]]
>> layout.widths$ylab <- list(x=1, units="cm", data=NULL)
>> layout.widths$panel <- list(x=1, units="null", data=NULL)
>> layout.widths$key.right <- list(x=1, units="cm", data=NULL)
>> lattice.options(layout.widths=layout.widths)
>> # Force (width of) left axis labels to be the same
>> vol_p <- levelplot(volcano, scales=list(y=list(at=seq(10, 60, 10),
>>   labels=rep(" ", 6
>> print(vol_p, newpage=FALSE, prefix="vol_p")
>> downViewport("vol_p.panel.1.1.off.vp")
>> # Draw proper left axis labels
>> grid.text(seq(10, 60, 10), x=unit(0, "npc") - unit(1, "lines"),
>>  y=unit(seq(10, 60, 10), "native"), just="right",
>>  gp=gpar(cex=.8))
>> # Determine width of levelplot panel
>> border <- grid.get("border", grep=TRUE)
>> width <- convertWidth(border$width, "in", valueOnly=TRUE)
>> xscale <- current.viewport()$xscale
>> upViewport(0)
>> pushViewport(viewport(y=.5, height=.5, just="bottom"))
>> # Force identical widths where we can
>> layout.widths$ylab <- list(x=1, units="cm", data=NULL)
>> layout.widths$panel <- list(x=width, units="in", data=NULL)
>> layout.widths$key.right <- list(x=1, units="cm", data=NULL)
>> lattice.options(layout.widths=layout.widths)
>> # Force (width of) left axis labels to be the same
>> xy_p <- xyplot(y ~ x, data = xy, xlim=xscale,
>>   scales=list(y=list(at=seq(100, 200, 20),
>>  labels=rep(" ", 11
>> print(xy_p, newpage=FALSE, prefix="xy_p")
>> downViewport("xy_p.panel.1.1.off.vp")
>> # Draw proper left axis labels
>> grid.text(seq(100, 200, 20), x=unit(0, "npc") - unit(1, "lines"),
>>  y=unit(seq(100, 200, 20), "native"), just="right",
>>  gp=gpar(cex=.8))
>> upViewport(0)
>>
>> Paul
>>
>> On 26/10/16 10:50, Ben Tupper wrote:
>>> Hi,
>>>
>>> Almost but not quite.  It certainly moves the ball down the field, and, 
>>> dang, that would be way too easy!
>>>
>>> I have been fiddling with the panel.widths to the lattice::plot method.  No 
>>> joy yet.
>>>
>>>
>>> Ben
>>>
>>>
 On Oct 25, 2016, at 5:14 PM, Paul Murrell  wrote:

 Hi

 Does this do what you want ?

 library(latticeExtra)
 c(vol_p, xy_p, x.same=TRUE)

 Paul

 On 26/10/16 04:30, Ben Tupper wrote:
> Thanks, Bert.
>
> I have used latticeExtra for layering graphics.  I'm not sure how I
> would use it to align graphics rather superimposing them.
>
> I shall look into the the custom panel plot but that is very new
> territory for me.
>
> Ben
>
>> On Oct 25, 2016, at 9:13 AM, Bert Gunter 
>> wrote:
>>
>> Write a custom panel function for levelplot() that calls
>> panel.xyplot after panel.levelplot. I believe this can also be done
>> by the +  operator of the latticeExtra package.
>>
>> You do *not* want to call xyplot after levelplot, as that
>> completely redraws the plot.
>>
>> Cheers, Bert
>>
>>
>> On Oct 25, 2016 2:55 PM, "Ben Tupper" > > wrote: Hello,
>>
>> I am drawing a levelplot and an xyplot on a single device as shown
>> in the runnable example below.  I would like the x axes to align -
>> that is for them to cover the same extent left-to-right on the
>> device. How do I go about doing that?
>>
>> ### # START ### library(lattice)
>>
>> d <- dim(volcano) xy <- data.frame(x = 1:d[1], y = volcano[,30] )
>>
>> vol_p <- levelplot(volcano) xy_p <- xyplot(y ~ x, data = xy)
>>
>> print(vol_p, split = c(1, 2, 1, 

Re: [R] [FORGED] lattice: control panel extent on device

2016-10-25 Thread Ben Tupper
Wow!  That's exactly what I am looking for!

I have had both books* open in front of me all day to no avail, and, I was 
spinning round and round - I was waaay off in left field.

Thanks so much!
Ben


* https://www.r-project.org/doc/bib/R-books_bib.html#R:Sarkar:2008
  https://www.r-project.org/doc/bib/R-books_bib.html#R:Murrell:2011

> On Oct 25, 2016, at 8:07 PM, Paul Murrell  wrote:
> 
> Hi
> 
> This might work, though it's a teensy bit more complicated and a bit manual 
> (on the left axis labels) and it ignores heights and vertical whitespace ...
> 
> library(lattice)
> d <- dim(volcano)
> xy <- data.frame(x = 1:d[1], y = volcano[,30] )
> library(grid)
> grid.newpage()
> pushViewport(viewport(y=0, height=.5, just="bottom"))
> # Force identical widths where we can
> layout.widths <- lattice.options("layout.widths")[[1]]
> layout.widths$ylab <- list(x=1, units="cm", data=NULL)
> layout.widths$panel <- list(x=1, units="null", data=NULL)
> layout.widths$key.right <- list(x=1, units="cm", data=NULL)
> lattice.options(layout.widths=layout.widths)
> # Force (width of) left axis labels to be the same
> vol_p <- levelplot(volcano, scales=list(y=list(at=seq(10, 60, 10),
>   labels=rep(" ", 6
> print(vol_p, newpage=FALSE, prefix="vol_p")
> downViewport("vol_p.panel.1.1.off.vp")
> # Draw proper left axis labels
> grid.text(seq(10, 60, 10), x=unit(0, "npc") - unit(1, "lines"),
>  y=unit(seq(10, 60, 10), "native"), just="right",
>  gp=gpar(cex=.8))
> # Determine width of levelplot panel
> border <- grid.get("border", grep=TRUE)
> width <- convertWidth(border$width, "in", valueOnly=TRUE)
> xscale <- current.viewport()$xscale
> upViewport(0)
> pushViewport(viewport(y=.5, height=.5, just="bottom"))
> # Force identical widths where we can
> layout.widths$ylab <- list(x=1, units="cm", data=NULL)
> layout.widths$panel <- list(x=width, units="in", data=NULL)
> layout.widths$key.right <- list(x=1, units="cm", data=NULL)
> lattice.options(layout.widths=layout.widths)
> # Force (width of) left axis labels to be the same
> xy_p <- xyplot(y ~ x, data = xy, xlim=xscale,
>   scales=list(y=list(at=seq(100, 200, 20),
>  labels=rep(" ", 11
> print(xy_p, newpage=FALSE, prefix="xy_p")
> downViewport("xy_p.panel.1.1.off.vp")
> # Draw proper left axis labels
> grid.text(seq(100, 200, 20), x=unit(0, "npc") - unit(1, "lines"),
>  y=unit(seq(100, 200, 20), "native"), just="right",
>  gp=gpar(cex=.8))
> upViewport(0)
> 
> Paul
> 
> On 26/10/16 10:50, Ben Tupper wrote:
>> Hi,
>> 
>> Almost but not quite.  It certainly moves the ball down the field, and, 
>> dang, that would be way too easy!
>> 
>> I have been fiddling with the panel.widths to the lattice::plot method.  No 
>> joy yet.
>> 
>> 
>> Ben
>> 
>> 
>>> On Oct 25, 2016, at 5:14 PM, Paul Murrell  wrote:
>>> 
>>> Hi
>>> 
>>> Does this do what you want ?
>>> 
>>> library(latticeExtra)
>>> c(vol_p, xy_p, x.same=TRUE)
>>> 
>>> Paul
>>> 
>>> On 26/10/16 04:30, Ben Tupper wrote:
 Thanks, Bert.
 
 I have used latticeExtra for layering graphics.  I'm not sure how I
 would use it to align graphics rather superimposing them.
 
 I shall look into the the custom panel plot but that is very new
 territory for me.
 
 Ben
 
> On Oct 25, 2016, at 9:13 AM, Bert Gunter 
> wrote:
> 
> Write a custom panel function for levelplot() that calls
> panel.xyplot after panel.levelplot. I believe this can also be done
> by the +  operator of the latticeExtra package.
> 
> You do *not* want to call xyplot after levelplot, as that
> completely redraws the plot.
> 
> Cheers, Bert
> 
> 
> On Oct 25, 2016 2:55 PM, "Ben Tupper"  > wrote: Hello,
> 
> I am drawing a levelplot and an xyplot on a single device as shown
> in the runnable example below.  I would like the x axes to align -
> that is for them to cover the same extent left-to-right on the
> device. How do I go about doing that?
> 
> ### # START ### library(lattice)
> 
> d <- dim(volcano) xy <- data.frame(x = 1:d[1], y = volcano[,30] )
> 
> vol_p <- levelplot(volcano) xy_p <- xyplot(y ~ x, data = xy)
> 
> print(vol_p, split = c(1, 2, 1, 2), more = TRUE) print(xy_p,  split
> = c(1, 1, 1, 2), more = FALSE) ## #END ##
> 
> 
> Thanks! Ben
> 
> 
>> sessionInfo()
> R version 3.3.1 (2016-06-21) Platform: x86_64-apple-darwin13.4.0
> (64-bit) Running under: OS X 10.11.6 (El Capitan)
> 
> locale: [1]
> en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> 
> attached base packages: [1] stats graphics  grDevices utils
> datasets  methods   base
> 
> other attached packages: 

Re: [R] About converting files in R

2016-10-25 Thread Bob Rudis
Can you tell us where you got the file from and perhaps even send a
link to the file? I know of at least 11 types of files that use `.bin`
as an extension which are all different types of data with different
binary formats.

On Tue, Oct 25, 2016 at 5:40 PM, Bob Rudis  wrote:
> I'm afraid we'll need more information that that since the answer from
> many folks on the list to such a generic question is going to be a
> generic "yes".
>
> What's the source of the binary files? If you know the type, there may
> even be an R package for it already.
>
> On Tue, Oct 25, 2016 at 5:28 PM, lily li  wrote:
>> Hi R users,
>>
>> Do any of you have any experience about converting binary files to ascii or
>> txt files in R? Thanks a lot for your help.
>>
>> [[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] lattice: control panel extent on device

2016-10-25 Thread Duncan Mackay
Hi Ben

A bit kludgy but it works. Further refinement by eye

print(vol_p, position = c(0,0,1,0.5), more = TRUE)
print(xy_p, position = c(0.14,0.5,0.86,1), more = FALSE)

I do not know if viewports will be  any better

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 Ben Tupper
Sent: Tuesday, 25 October 2016 23:53
To: r-help
Subject: [R] lattice: control panel extent on device

Hello,

I am drawing a levelplot and an xyplot on a single device as shown in the
runnable example below.  I would like the x axes to align - that is for them
to cover the same extent left-to-right on the device. How do I go about
doing that?

###
# START
###
library(lattice)

d <- dim(volcano)
xy <- data.frame(x = 1:d[1], y = volcano[,30] )

vol_p <- levelplot(volcano)
xy_p <- xyplot(y ~ x, data = xy)

print(vol_p, split = c(1, 2, 1, 2), more = TRUE)
print(xy_p,  split = c(1, 1, 1, 2), more = FALSE)
##
#END
##


Thanks!
Ben


> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.6 (El Capitan)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] lattice_0.20-33

loaded via a namespace (and not attached):
[1] tools_3.3.1 grid_3.3.1 



Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

__
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] [FORGED] Re: lattice: control panel extent on device

2016-10-25 Thread Paul Murrell

Hi

This might work, though it's a teensy bit more complicated and a bit 
manual (on the left axis labels) and it ignores heights and vertical 
whitespace ...


library(lattice)
d <- dim(volcano)
xy <- data.frame(x = 1:d[1], y = volcano[,30] )
library(grid)
grid.newpage()
pushViewport(viewport(y=0, height=.5, just="bottom"))
# Force identical widths where we can
layout.widths <- lattice.options("layout.widths")[[1]]
layout.widths$ylab <- list(x=1, units="cm", data=NULL)
layout.widths$panel <- list(x=1, units="null", data=NULL)
layout.widths$key.right <- list(x=1, units="cm", data=NULL)
lattice.options(layout.widths=layout.widths)
# Force (width of) left axis labels to be the same
vol_p <- levelplot(volcano, scales=list(y=list(at=seq(10, 60, 10),
   labels=rep(" ", 6
print(vol_p, newpage=FALSE, prefix="vol_p")
downViewport("vol_p.panel.1.1.off.vp")
# Draw proper left axis labels
grid.text(seq(10, 60, 10), x=unit(0, "npc") - unit(1, "lines"),
  y=unit(seq(10, 60, 10), "native"), just="right",
  gp=gpar(cex=.8))
# Determine width of levelplot panel
border <- grid.get("border", grep=TRUE)
width <- convertWidth(border$width, "in", valueOnly=TRUE)
xscale <- current.viewport()$xscale
upViewport(0)
pushViewport(viewport(y=.5, height=.5, just="bottom"))
# Force identical widths where we can
layout.widths$ylab <- list(x=1, units="cm", data=NULL)
layout.widths$panel <- list(x=width, units="in", data=NULL)
layout.widths$key.right <- list(x=1, units="cm", data=NULL)
lattice.options(layout.widths=layout.widths)
# Force (width of) left axis labels to be the same
xy_p <- xyplot(y ~ x, data = xy, xlim=xscale,
   scales=list(y=list(at=seq(100, 200, 20),
  labels=rep(" ", 11
print(xy_p, newpage=FALSE, prefix="xy_p")
downViewport("xy_p.panel.1.1.off.vp")
# Draw proper left axis labels
grid.text(seq(100, 200, 20), x=unit(0, "npc") - unit(1, "lines"),
  y=unit(seq(100, 200, 20), "native"), just="right",
  gp=gpar(cex=.8))
upViewport(0)

Paul

On 26/10/16 10:50, Ben Tupper wrote:

Hi,

Almost but not quite.  It certainly moves the ball down the field, and, dang, 
that would be way too easy!

I have been fiddling with the panel.widths to the lattice::plot method.  No joy 
yet.


Ben



On Oct 25, 2016, at 5:14 PM, Paul Murrell  wrote:

Hi

Does this do what you want ?

library(latticeExtra)
c(vol_p, xy_p, x.same=TRUE)

Paul

On 26/10/16 04:30, Ben Tupper wrote:

Thanks, Bert.

I have used latticeExtra for layering graphics.  I'm not sure how I
would use it to align graphics rather superimposing them.

I shall look into the the custom panel plot but that is very new
territory for me.

Ben


On Oct 25, 2016, at 9:13 AM, Bert Gunter 
wrote:

Write a custom panel function for levelplot() that calls
panel.xyplot after panel.levelplot. I believe this can also be done
by the +  operator of the latticeExtra package.

You do *not* want to call xyplot after levelplot, as that
completely redraws the plot.

Cheers, Bert


On Oct 25, 2016 2:55 PM, "Ben Tupper" > wrote: Hello,

I am drawing a levelplot and an xyplot on a single device as shown
in the runnable example below.  I would like the x axes to align -
that is for them to cover the same extent left-to-right on the
device. How do I go about doing that?

### # START ### library(lattice)

d <- dim(volcano) xy <- data.frame(x = 1:d[1], y = volcano[,30] )

vol_p <- levelplot(volcano) xy_p <- xyplot(y ~ x, data = xy)

print(vol_p, split = c(1, 2, 1, 2), more = TRUE) print(xy_p,  split
= c(1, 1, 1, 2), more = FALSE) ## #END ##


Thanks! Ben



sessionInfo()

R version 3.3.1 (2016-06-21) Platform: x86_64-apple-darwin13.4.0
(64-bit) Running under: OS X 10.11.6 (El Capitan)

locale: [1]
en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages: [1] lattice_0.20-33

loaded via a namespace (and not attached): [1] tools_3.3.1
grid_3.3.1



Ben Tupper Bigelow Laboratory for Ocean Sciences 60 Bigelow Drive,
P.O. Box 380 East Boothbay, Maine 04544 http://www.bigelow.org


__ 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.



Ben Tupper Bigelow Laboratory for Ocean Sciences 60 Bigelow Drive,
P.O. Box 380 East Boothbay, Maine 04544 http://www.bigelow.org




[[alternative HTML version deleted]]

__ 

Re: [R] Can anyone help me with the below problem? I have tried stackoverflow but no help

2016-10-25 Thread Vivek Das
Dear Sarah,

Thank you for your reply. I cannot upgrade debian since it is an HPC and I
do not have root priviledges. I will try to install and older version that
is compatible and report. Thanks a lot.
Regards,

Vivek

On Oct 26, 2016 1:46 AM, "Sarah Goslee"  wrote:

> I don't see your session info in the stackoverflow posting, but it
> looks like you're using Debian 6, which hit its end of life in
> February 2016. So the best way to get the current GLIBCXX is to
> upgrade to a current version of Debian.
>
> A google search on installing GLIBCXX_3.4.15 on Debian 6 turns up a
> bunch of hits, so you may be able to find a work-around if necessary.
> You might also be able to download the source for an older version of
> igraph that works with your system.
>
> Sarah
>
> On Tue, Oct 25, 2016 at 6:48 PM, Vivek Das  wrote:
> > Dear Users,
> >
> > I have a problem with installing a particular r-package in R -3.1.2 in my
> > work Debian. The problem is mentioned in the link below. I have tried to
> > seek help from stackoverflow but have not received any help. It would be
> > great if anyone can point out the problem and let me know how I can have
> a
> > workaround. I do not intend to install another version of R in our office
> > workspace. I already have latest in my personal office laptop but since I
> > handle large data files as well I try to use the R-3.1 in HPC cluster
> from
> > my /home/ directory in office debian. Now I want to install igraph in it
> bu
> > I having the problem. It would be kind if you can let me know how to fix
> > it. Thanks
> >
> > http://stackoverflow.com/questions/40244946/error-with-
> installing-igraph-in-r-3-1-2-in-our-hpc-cluster-at-work
> > --
> >
>

[[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 in a regression

2016-10-25 Thread John Dougherty
On Mon, 24 Oct 2016 10:54:00 -0500
Andrea Marcela Huerfano Barbosa  wrote:

> Hi guys,
> When I try to do a linear regression into the console appears this
> warning message:
> 
> >* attempting model selection on an essentially perfect fit is
> >nonsense*
> 
> Some one could tell me what does it mean and maybe a way to solve it.
> 
> Thanks in advance,
> 
> Andrea Marcela
> 
Andrea, there is far too little information in your post for us to help
you.  The standard lm() routine doesn't produce that message in any
model. You need to provide a sample the data and explain what routine
you are using to select the model.

-- 

John

__
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] Can anyone help me with the below problem? I have tried stackoverflow but no help

2016-10-25 Thread Sarah Goslee
I don't see your session info in the stackoverflow posting, but it
looks like you're using Debian 6, which hit its end of life in
February 2016. So the best way to get the current GLIBCXX is to
upgrade to a current version of Debian.

A google search on installing GLIBCXX_3.4.15 on Debian 6 turns up a
bunch of hits, so you may be able to find a work-around if necessary.
You might also be able to download the source for an older version of
igraph that works with your system.

Sarah

On Tue, Oct 25, 2016 at 6:48 PM, Vivek Das  wrote:
> Dear Users,
>
> I have a problem with installing a particular r-package in R -3.1.2 in my
> work Debian. The problem is mentioned in the link below. I have tried to
> seek help from stackoverflow but have not received any help. It would be
> great if anyone can point out the problem and let me know how I can have a
> workaround. I do not intend to install another version of R in our office
> workspace. I already have latest in my personal office laptop but since I
> handle large data files as well I try to use the R-3.1 in HPC cluster from
> my /home/ directory in office debian. Now I want to install igraph in it bu
> I having the problem. It would be kind if you can let me know how to fix
> it. Thanks
>
> http://stackoverflow.com/questions/40244946/error-with-installing-igraph-in-r-3-1-2-in-our-hpc-cluster-at-work
> --
>

__
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] Can anyone help me with the below problem? I have tried stackoverflow but no help

2016-10-25 Thread Vivek Das
Dear Users,

I have a problem with installing a particular r-package in R -3.1.2 in my
work Debian. The problem is mentioned in the link below. I have tried to
seek help from stackoverflow but have not received any help. It would be
great if anyone can point out the problem and let me know how I can have a
workaround. I do not intend to install another version of R in our office
workspace. I already have latest in my personal office laptop but since I
handle large data files as well I try to use the R-3.1 in HPC cluster from
my /home/ directory in office debian. Now I want to install igraph in it bu
I having the problem. It would be kind if you can let me know how to fix
it. Thanks

http://stackoverflow.com/questions/40244946/error-with-installing-igraph-in-r-3-1-2-in-our-hpc-cluster-at-work
--

Vivek Das

[[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] Limit the y-axis line with ggplot2 (not the axis itself, but the line used at the left of the graph)

2016-10-25 Thread Zach Simpson
> Hello everybody,
>
> Using ggplot2 package, is there a way to force to stop the y-axis line
> at a specified point ? (not using ylim because I want that some text
> written using annotate() at the top of the graph is 
> still shown).
>
> Bellow is a simple example to show what I would like do:
>
>   Thanks a lot
>
> Marc
>
>
>
>
>
> library("ggplot2")
>
> g <- ggplot()+
>   geom_point(aes(x=c(20, 29, 32), y=c(0, 0.4, 1)))+
>   scale_y_continuous(breaks=c(0, 0.25, 0.5, 0.75, 1))+
>   labs(x="Label for x axis")+
>   labs(y="Label for y axis") +
>   annotate("text", x = 25 , y=1.2, label="Text 1")+
>   annotate("text", x = 22 , y=1.0, label="How to stop the y-axis line
>here !")+
>   geom_segment(aes(x=25, xend=25, y=0, yend=1.1), linetype=2)+
>   > This part is just to make it more nice
>   theme(panel.background = element_rect(fill = 'white'),
> panel.grid.major = element_blank(),
> panel.grid.minor = element_blank(),
> plot.margin = unit(c(0.5, 1, 0.5, 0.5), "cm"),
> axis.text.x=element_text(size=14),
> axis.text.y=element_text(size=14),
> axis.title.x=element_text(size=18),
> axis.title.y=element_text(size=18),
> axis.ticks.length=unit(0.3,"cm"),
> panel.border = element_blank(),
> axis.line.x = element_line(),
> axis.line.y = element_line())
> g

Hey Marc,

I feel there's a better solution out there, but I think I got what
you're after by replacing the y-axis with a
`annotate(geom="segment")`, which I could manipulate using the y and
yend arguments.

It took some other finagling of the other elements though.

#after already defining g per the OP
g + scale_x_continuous(limits = c(19,32.5), expand = c(0,0)) +
  scale_y_continuous(limits=c(-0.05,1.25), breaks=c(0, 0.25, 0.5,
0.75, 1), expand = c(0,0))+
  annotate(geom = "segment", x=19, xend = 19, y = -0.05, yend = 1)+
  theme(axis.line.y = element_blank())

Cheers,

Zach

__
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] [FORGED] Re: lattice: control panel extent on device

2016-10-25 Thread Ben Tupper
Hi,

Almost but not quite.  It certainly moves the ball down the field, and, dang, 
that would be way too easy!  

I have been fiddling with the panel.widths to the lattice::plot method.  No joy 
yet.


Ben


> On Oct 25, 2016, at 5:14 PM, Paul Murrell  wrote:
> 
> Hi
> 
> Does this do what you want ?
> 
> library(latticeExtra)
> c(vol_p, xy_p, x.same=TRUE)
> 
> Paul
> 
> On 26/10/16 04:30, Ben Tupper wrote:
>> Thanks, Bert.
>> 
>> I have used latticeExtra for layering graphics.  I'm not sure how I
>> would use it to align graphics rather superimposing them.
>> 
>> I shall look into the the custom panel plot but that is very new
>> territory for me.
>> 
>> Ben
>> 
>>> On Oct 25, 2016, at 9:13 AM, Bert Gunter 
>>> wrote:
>>> 
>>> Write a custom panel function for levelplot() that calls
>>> panel.xyplot after panel.levelplot. I believe this can also be done
>>> by the +  operator of the latticeExtra package.
>>> 
>>> You do *not* want to call xyplot after levelplot, as that
>>> completely redraws the plot.
>>> 
>>> Cheers, Bert
>>> 
>>> 
>>> On Oct 25, 2016 2:55 PM, "Ben Tupper" >> > wrote: Hello,
>>> 
>>> I am drawing a levelplot and an xyplot on a single device as shown
>>> in the runnable example below.  I would like the x axes to align -
>>> that is for them to cover the same extent left-to-right on the
>>> device. How do I go about doing that?
>>> 
>>> ### # START ### library(lattice)
>>> 
>>> d <- dim(volcano) xy <- data.frame(x = 1:d[1], y = volcano[,30] )
>>> 
>>> vol_p <- levelplot(volcano) xy_p <- xyplot(y ~ x, data = xy)
>>> 
>>> print(vol_p, split = c(1, 2, 1, 2), more = TRUE) print(xy_p,  split
>>> = c(1, 1, 1, 2), more = FALSE) ## #END ##
>>> 
>>> 
>>> Thanks! Ben
>>> 
>>> 
 sessionInfo()
>>> R version 3.3.1 (2016-06-21) Platform: x86_64-apple-darwin13.4.0
>>> (64-bit) Running under: OS X 10.11.6 (El Capitan)
>>> 
>>> locale: [1]
>>> en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>>> 
>>> attached base packages: [1] stats graphics  grDevices utils
>>> datasets  methods   base
>>> 
>>> other attached packages: [1] lattice_0.20-33
>>> 
>>> loaded via a namespace (and not attached): [1] tools_3.3.1
>>> grid_3.3.1
>>> 
>>> 
>>> 
>>> Ben Tupper Bigelow Laboratory for Ocean Sciences 60 Bigelow Drive,
>>> P.O. Box 380 East Boothbay, Maine 04544 http://www.bigelow.org
>>> 
>>> 
>>> __ 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.
>>> 
>> 
>> Ben Tupper Bigelow Laboratory for Ocean Sciences 60 Bigelow Drive,
>> P.O. Box 380 East Boothbay, Maine 04544 http://www.bigelow.org
>> 
>> 
>> 
>> 
>> [[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.
>> 
> 
> -- 
> Dr Paul Murrell
> Department of Statistics
> The University of Auckland
> Private Bag 92019
> Auckland
> New Zealand
> 64 9 3737599 x85392
> p...@stat.auckland.ac.nz
> http://www.stat.auckland.ac.nz/~paul/

Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

__
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] About converting files in R

2016-10-25 Thread Mark Sharp
Lily,

Bob's suggestion is the best. You can also look at readBin(). Enter ?readBin at 
the R prompt.

Mark
R. Mark Sharp, Ph.D.
msh...@txbiomed.org





> On Oct 25, 2016, at 4:40 PM, Bob Rudis  wrote:
>
> I'm afraid we'll need more information that that since the answer from
> many folks on the list to such a generic question is going to be a
> generic "yes".
>
> What's the source of the binary files? If you know the type, there may
> even be an R package for it already.
>
> On Tue, Oct 25, 2016 at 5:28 PM, lily li  wrote:
>> Hi R users,
>>
>> Do any of you have any experience about converting binary files to ascii or
>> txt files in R? Thanks a lot for your help.
>>
>>[[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.

CONFIDENTIALITY NOTICE: This e-mail and any files and/or...{{dropped:10}}

__
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] About converting files in R

2016-10-25 Thread Bob Rudis
I'm afraid we'll need more information that that since the answer from
many folks on the list to such a generic question is going to be a
generic "yes".

What's the source of the binary files? If you know the type, there may
even be an R package for it already.

On Tue, Oct 25, 2016 at 5:28 PM, lily li  wrote:
> Hi R users,
>
> Do any of you have any experience about converting binary files to ascii or
> txt files in R? Thanks a lot for your help.
>
> [[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] About converting files in R

2016-10-25 Thread lily li
Hi R users,

Do any of you have any experience about converting binary files to ascii or
txt files in R? Thanks a lot for your help.

[[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] [FORGED] Re: lattice: control panel extent on device

2016-10-25 Thread Paul Murrell

Hi

Does this do what you want ?

library(latticeExtra)
c(vol_p, xy_p, x.same=TRUE)

Paul

On 26/10/16 04:30, Ben Tupper wrote:

Thanks, Bert.

I have used latticeExtra for layering graphics.  I'm not sure how I
would use it to align graphics rather superimposing them.

I shall look into the the custom panel plot but that is very new
territory for me.

Ben


On Oct 25, 2016, at 9:13 AM, Bert Gunter 
wrote:

Write a custom panel function for levelplot() that calls
panel.xyplot after panel.levelplot. I believe this can also be done
by the +  operator of the latticeExtra package.

You do *not* want to call xyplot after levelplot, as that
completely redraws the plot.

Cheers, Bert


On Oct 25, 2016 2:55 PM, "Ben Tupper" > wrote: Hello,

I am drawing a levelplot and an xyplot on a single device as shown
in the runnable example below.  I would like the x axes to align -
that is for them to cover the same extent left-to-right on the
device. How do I go about doing that?

### # START ### library(lattice)

d <- dim(volcano) xy <- data.frame(x = 1:d[1], y = volcano[,30] )

vol_p <- levelplot(volcano) xy_p <- xyplot(y ~ x, data = xy)

print(vol_p, split = c(1, 2, 1, 2), more = TRUE) print(xy_p,  split
= c(1, 1, 1, 2), more = FALSE) ## #END ##


Thanks! Ben



sessionInfo()

R version 3.3.1 (2016-06-21) Platform: x86_64-apple-darwin13.4.0
(64-bit) Running under: OS X 10.11.6 (El Capitan)

locale: [1]
en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages: [1] lattice_0.20-33

loaded via a namespace (and not attached): [1] tools_3.3.1
grid_3.3.1



Ben Tupper Bigelow Laboratory for Ocean Sciences 60 Bigelow Drive,
P.O. Box 380 East Boothbay, Maine 04544 http://www.bigelow.org


__ 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.



Ben Tupper Bigelow Laboratory for Ocean Sciences 60 Bigelow Drive,
P.O. Box 380 East Boothbay, Maine 04544 http://www.bigelow.org




[[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.



--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
p...@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

__
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] Limit the y-axis line with ggplot2 (not the axis itself, but the line used at the left of the graph) [SOLVED]

2016-10-25 Thread Paul Murrell

Hi

Here are some alternatives that involve messing about with the grobs and 
viewports after the plot has been drawn.  The percentage optimality of 
these solutions is up for debate ...


###
# Edit the y-axis line after drawing
library("ggplot2"); library("grid")
g <- ggplot()+
  geom_point(aes(x=c(20, 29, 32), y=c(0, 0.4, 1)))+
  scale_y_continuous(breaks=c(0, 0.25, 0.5, 0.75, 1))+
  labs(x="Label for x axis")+
  labs(y="Label for y axis") +
  annotate("text", x = 25 , y=1.2, label="Text 1")+
  annotate("text", x = 22 , y=1.0, label="How to stop the y-axis line 
here !")+

  geom_segment(aes(x=25, xend=25, y=0, yend=1.1), linetype=2)+
  # This part is just to make it more nice
  theme(panel.background = element_rect(fill = 'white'),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
plot.margin = unit(c(0.5, 1, 0.5, 0.5), "cm"),
axis.text.x=element_text(size=14),
axis.text.y=element_text(size=14),
axis.title.x=element_text(size=18),
axis.title.y=element_text(size=18),
axis.ticks.length=unit(0.3,"cm"),
panel.border = element_blank(),
axis.line.x = element_line(),
axis.line.y = element_line())
g
# Force creation of all grobs
grid.force()
# List all grobs
grid.ls()
# Get y-axis line y-locations
grid.get("axis.line.y..polyline", grep=TRUE)$y
# Edit y-axis line y-locations (trial-and-error to get 0.81)
grid.edit("axis.line.y..polyline", grep=TRUE, y=unit(c(0, 0.81), "npc"))

###
# Insert marker to work off and edit the y-axis line after drawing
library("ggplot2"); library("grid")
g <- ggplot()+
  geom_point(aes(x=c(20, 29, 32), y=c(0, 0.4, 1)))+
  scale_y_continuous(breaks=c(0, 0.25, 0.5, 0.75, 1))+
  labs(x="Label for x axis")+
  labs(y="Label for y axis") +
  annotate("text", x = 25 , y=1.2, label="Text 1")+
  annotate("text", x = 22 , y=1.0, label="How to stop the y-axis line 
here !")+

  geom_segment(aes(x=25, xend=25, y=0, yend=1.1), linetype=2)+
  # This part is just to make it more nice
  theme(panel.background = element_rect(fill = 'white'),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
plot.margin = unit(c(0.5, 1, 0.5, 0.5), "cm"),
axis.text.x=element_text(size=14),
axis.text.y=element_text(size=14),
axis.title.x=element_text(size=18),
axis.title.y=element_text(size=18),
axis.ticks.length=unit(0.3,"cm"),
panel.border = element_blank(),
axis.line.x = element_line(),
axis.line.y = element_line()) +
# marker
geom_point(aes(x=20, y=1), col="red")
g
# Force creation of all grobs
grid.force()
# List all grobs
grid.ls()
# Navigate to panel viewport
downViewport("panel.6-4-6-4")
# Get marker
marker <- grid.get("geom_point", grep=TRUE, global=TRUE)[[2]]
# Edit y-axis line y-locations (based on marker)
grid.edit("axis.line.y..polyline", grep=TRUE,
  y=convertY(unit(0:1, c("npc", "groby"), list(NULL, marker)), 
"npc"))

# grid.edit("axis.line.y..polyline", grep=TRUE,
#   y=unit(c(0, convertY(grobY(marker, 0), "npc", valueOnly=TRUE)),
#  "npc"))
# Remove marker
grid.remove(marker$name)

###
# Just draw the plot, with margin above, vertical dash line clipped
library("ggplot2"); library("grid")
g <- ggplot()+
  geom_point(aes(x=c(20, 29, 32), y=c(0, 0.4, 1)))+
  scale_y_continuous(breaks=c(0, 0.25, 0.5, 0.75, 1),
 limits=c(-.05, 1), expand=c(0, 0),
 oob=function(x, range) x)+
  labs(x="Label for x axis")+
  labs(y="Label for y axis") +
  annotate("text", x = 25 , y=1.2, label="Text 1")+
  annotate("text", x = 22 , y=1.0, label="How to stop the y-axis line 
here !")+

  geom_segment(aes(x=25, xend=25, y=0, yend=1.1), linetype=2)+
  # This part is just to make it more nice
  theme(panel.background = element_rect(fill = 'white'),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
plot.margin = unit(c(3, 1, 0.5, 0.5), "cm"),
axis.text.x=element_text(size=14),
axis.text.y=element_text(size=14),
axis.title.x=element_text(size=18),
axis.title.y=element_text(size=18),
axis.ticks.length=unit(0.3,"cm"),
panel.border = element_blank(),
axis.line.x = element_line(),
axis.line.y = element_line())
g
# Force creation of all grobs
grid.force()
# List all grobs
grid.ls()
# Navigate to panel viewport
downViewport("panel.6-4-6-4")
# Get the line segment and label
seg <- grid.get("segments", grep=TRUE)
lab <- grid.get("text", grep=TRUE)
# Push new viewport with clipping off
pushViewport(viewport(clip="off"))
# Draw line segment and text
grid.draw(seg)
grid.draw(lab)
# Clean up
upViewport()

Paul

On 

Re: [R-es] Colores en names.arg de un barplot()

2016-10-25 Thread javier.ruben.marcuzzi
Estimado Mauricio Monsalvo

No voy a poder leer y correr el archivo, tengo que resolver otro problema, si 
dentro de unos días no encuentra la solución, envíe nuevamente la pregunta y yo 
lo intento.

Javier Rubén Marcuzzi

De: Mauricio Monsalvo
Enviado: martes, 25 de octubre de 2016 15:29
Para: Marcuzzi, Javier Rubén
CC: r-help-es
Asunto: Re: [R-es] Colores en names.arg de un barplot()

Gracias, Javier. Está muy bueno el post, pero en efecto refiere a legend y no a 
los names.arg
Adjunto un archivo para poder correr el gráfico. Creo que eso ayuda a precisar 
el problema. Las etiquetas que aparecen al costado izquierdo de las barras son 
las que quiere pintar de negro y azul.
También va a necesitar este objeto para que la sintaxis corra sin errores:
library(RColorBrewer) #Para Colorear
col.segmentos <- brewer.pal(9,"Paired")
Gracias!

El 25 de octubre de 2016, 15:16,  escribió:
Estimado Mauricio Monsalvo
 
No leí detenidamente su correo, pero mire esto por si le sirve el ejemplo
http://www.magesblog.com/2012/12/changing-colours-and-legends-in-lattice.html
 
 
Javier Rubén Marcuzzi
 
De: Mauricio Monsalvo
Enviado: martes, 25 de octubre de 2016 15:11
Para: r-help-es
Asunto: [R-es] Colores en names.arg de un barplot()
 
Hola.
Tengo un gráfico que tiene muchos names.arg (demasiados...), de modo tal
que le vendría bien al lector usar colores intercalados, tal que el primero
sea azul, el segundo negro, el tercero azul, cuarto negro, y así. Es decir,
definir un vector "similar" a este:
 
rep(c("black", "blue"), length(barras[,1]/2)
 
que permita pintar uno y uno en este gráfico:
 
barplot(t(barras[,2:10]), horiz=T, col=col.segmentos, border=F, space=0,
las=1, cex=.75, cex.axis=1
    ,names.arg=row.names(barras), cex.names=0.6, col="red",
xlab="Valores liquidados, en $")
    legend(300, 60, xpd=T , inset=c(-0.1,0), cex=1, bty="n"#bg="white"
#, lwd=F , ncol=1, pch = 15
   ,segmentos ,fill = col.segmentos, border = "darkblue") #
    text(100, 33, paste("Principales", length(barras[,1]),"principios
activos."), adj = c(0,0))
    text(100, 30, paste("Explican el",
round(sum(barras1[,1])/sum(todos[,1])*100,1),"% del total."), adj = c(0,0))
    text(100, 27, paste("Excluye productos por
$",round(sum(barras1[,1])-sum(barras[,1]),1),"no identificados."), adj =
c(0,0))
    grid(nx=NULL, ny=NA, col = "gray", lwd = 1, lty = 3) #
 
​Obviamente, col() pinta las barras pero no los nombres.
¿Es posible hacerlo en lattice?
Muchas gracias.
 
-- 
Mauricio
 
    [[alternative HTML version deleted]]
 
___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es
 




-- 
Mauricio


[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

Re: [R] Finding starting values for the parameters using nls() or nls2()

2016-10-25 Thread David Winsemius

> On Oct 25, 2016, at 9:29 AM, dave fournier  wrote:
> 
> 
> 
> Unfortunately this problem does not appear to be well posed.
> 
>Retention = (b0*Area^(th+1))^b
> 
> If b0, th, and b are the parameter only the product (th+1)*b is determined.
> 
> This comes from noting that powers satisfy
> 
> 
> 
>(a^b)^c  =  a^(b*c)
> 
> 
> 
> So your model can be written as
> 
> 
> 
>  (b0^b) * Area^((th+1)*b)
> 

... which nicely completes the thread since one model had:

th1   =  9.1180e-01
 b01=5.2104e+00
 b11 =  -4.6725e-04
(th1+1)*b11
[1] -0.0008932885


 b0  = 5.2104466   ;b1 =   -0.0004672   ;  th =  0.9118029
((th+1)*b1)
[1] -0.0008931943

So both the R's nls2 and AD_MOdel_Builder results yield that same predictions 
for any given data point at least up to four decimal places.

So perhaps there was some other physical interpretation of those parameters and 
there exists an underlying theory that would support adding some extra 
constraints? 

-- 
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-es] Colores en names.arg de un barplot()

2016-10-25 Thread Mauricio Monsalvo
Hola.
Tengo un gráfico que tiene muchos names.arg (demasiados...), de modo tal
que le vendría bien al lector usar colores intercalados, tal que el primero
sea azul, el segundo negro, el tercero azul, cuarto negro, y así. Es decir,
definir un vector "similar" a este:

rep(c("black", "blue"), length(barras[,1]/2)

que permita pintar uno y uno en este gráfico:

barplot(t(barras[,2:10]), horiz=T, col=col.segmentos, border=F, space=0,
las=1, cex=.75, cex.axis=1
,names.arg=row.names(barras), cex.names=0.6, col="red",
xlab="Valores liquidados, en $")
legend(300, 60, xpd=T , inset=c(-0.1,0), cex=1, bty="n"#bg="white"
#, lwd=F , ncol=1, pch = 15
   ,segmentos ,fill = col.segmentos, border = "darkblue") #
text(100, 33, paste("Principales", length(barras[,1]),"principios
activos."), adj = c(0,0))
text(100, 30, paste("Explican el",
round(sum(barras1[,1])/sum(todos[,1])*100,1),"% del total."), adj = c(0,0))
text(100, 27, paste("Excluye productos por
$",round(sum(barras1[,1])-sum(barras[,1]),1),"no identificados."), adj =
c(0,0))
grid(nx=NULL, ny=NA, col = "gray", lwd = 1, lty = 3) #

​Obviamente, col() pinta las barras pero no los nombres.
¿Es posible hacerlo en lattice?
Muchas gracias.

-- 
Mauricio

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

Re: [R] Finding starting values for the parameters using nls() or nls2()

2016-10-25 Thread dave fournier



 Unfortunately this problem does not appear to be well posed.

Retention = (b0*Area^(th+1))^b

If b0, th, and b are the parameter only the product (th+1)*b is determined.

This comes from noting that powers satisfy



(a^b)^c  =  a^(b*c)



So your model can be written as



  (b0^b) * Area^((th+1)*b)

__
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: [ESS] wget/curl and DOWNLOAD make variable customization WAS: ESS 16.10 released

2016-10-25 Thread Vincent Goulet
I would add that the current (16.10) setup further requires Internet access to 
build ESS. It might be a trivial concern, but shouldn't the archive be complete 
once it's been downloaded?

v.


> Le 25 oct. 2016 à 09:28, Sparapani, Rodney  a écrit :
> 
> 
> To Martin: are you serious about “everyone” having R?  I don’t think you can 
> assume that.
> I often install ESS on systems that don’t have R.  We have many sites (ok 2 
> ;o) that could not
> care less about R.  I do not want to have to install R just to install ESS.  
> And frankly, this
> whole mess is created by julia support which I really do NOT care about at 
> all.
> 
> To Martin and Vincent:  The answer is to customize the DOWNLOAD variable 
> appropriately,
> i.e. on Mac OS X I use DOWNLOAD = curl which you merely have to uncomment in 
> Makeconf.
> 
> Rodney
> 
> 
> Martin 
> Maechler
>  Mon, 24 Oct 2016 09:38:33 
> -0700
> X-Body-of-Message
>> Vincent Goulet 
>>on Mon, 24 Oct 2016 10:35:15 -0400 writes:
>> To all: my Emacs distributions are updated:
> 
>> macOS: http://vgoulet.act.ulaval.ca/en/emacs/mac/
>> Windows: http://vgoulet.act.ulaval.ca/en/emacs/windows/
> 
> Excellent.
> Thank you very much, Vincent, for providing them so nicely pre-packaged!
> 
>> To Martin and ESS core:
> 
>> I realize I should have tested this in beta phase, but here goes: when
> building ESS from a fresh archive, I get this error on OS X:
> 
>> In end of data:
>> ess-julia.el:431:1:Warning: the following functions are not known to be
>> defined: ess-julia--get-objects, ess-julia--retrive-topics,
>> ess-julia--get-components, ess-julia-objects, company-begin-backend,
>> company-in-string-or-comment, company-doc-buffer,
>> ess-julia-get-object-help-string, julia-mode
>> wget -O -
> https://raw.githubusercontent.com/JuliaLang/julia-emacs/master/julia-mode.el >
> julia-mode.el
>> /bin/sh: wget: command not found
>> make[2]: *** [julia-mode.el] Error 127
> 
>> Indeed, fetching files on OS X (aka macOS now) requires curl instead of
> wget.
> 
> This comes from /Makeconf
> 
> DOWNLOAD = wget -O -
> 
> Since we rely on GNU makefile style anyway, we could replace the
> above by smart if(.) constructions... But MacOS and Windows may
> change again in the future ... (and Linux too, but there we find
> that an replace 'wget ..' appropriately).
> 
> On the other hand, R has  download.file()  and "everybody" has
> R, so we could think of replacing that by
> 
>   Rscript -e 'download.file(..)'
> 
> and rely that R will be updated to keep download.file() always
> working  ??
> 
> 
>> On Windows, wget is ok, but I get an "The certificate of
> 'raw.githubusercontent.com' is not trusted" error.
> 
> Hmm... I think this should be workable-around by a  wget switch?
> 
>> Surprisingly, relaunching the build process worked on both platforms.
> 
> (Well, 'make' is not perfect and even more our Makeconf/Makefile setup is not)
> 
>> Both problems seem related to build system-specific instructions in the
> ESS Makefiles.
> 
> *'Both'* ?  Which problem apart from 'wget -O -' not working
> correctly on Mac and Windows?
> 
>> Hope this helps.
>> v.
> 
> Yes, very much, thank you, Vincent!
> 
> Martin
> 
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
> 
> 
> 
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: [R] 100 fold cross validation in R

2016-10-25 Thread David Winsemius

> On Oct 25, 2016, at 9:22 AM, Santiago Bueno  wrote:
> 
> Dear experts,
> 
> I have to carry a 100 fold cross-validation of non linear regression
> models. Is it possible to find a way to do it in R.
> 

Show us your code for a single-fold validation.


> Best regards,
> 
> Santiago Bueno
> 
>   [[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.


[R] 100 fold cross validation in R

2016-10-25 Thread Santiago Bueno
Dear experts,

I have to carry a 100 fold cross-validation of non linear regression
models. Is it possible to find a way to do it in R.

Best regards,

Santiago Bueno

[[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] Limit the y-axis line with ggplot2 (not the axis itself, but the line used at the left of the graph) [SOLVED]

2016-10-25 Thread Marc Girondot

After many tries, here is a solution using grob.
I post here in case it could help someone.
Note that this solution is not 100% optimal as it uses a trick (limits = 
c(-0.05, 1.02)) to show fully the points.


Marc

library("ggplot2"); require("gtable"); require("grid")

p <- ggplot()+
  geom_point(aes(x=c(20, 29, 32), y=c(0, 0.4, 1)))+
  scale_y_continuous(breaks=c(0, 0.25, 0.5, 0.75, 1),
 expand = c(0, 0), limits = c(-0.05, 1.02))+
  xlim(20, 32) +
  labs(x="Label for x axis")+
  labs(y="Label for y axis") +
  geom_segment(aes(x=25, xend=25, y=0, yend=1), linetype=2)+
  # This part is just to make it more nice
  theme(panel.background = element_rect(fill = 'white'),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
plot.margin = unit(c(0.5, 1, 0.5, 0.5), "cm"),
axis.text.x=element_text(size=14),
axis.text.y=element_text(size=14),
axis.title.x=element_text(size=18),
axis.title.y=element_text(size=18),
axis.ticks.length=unit(0.3,"cm"),
panel.border = element_blank(),
axis.line.x = element_line(),
axis.line.y = element_line())


# I prepare the legend to be shown at the top
plegend <- ggplot() +
  geom_blank() +
  geom_segment(aes(x=25, xend=25, y=0, yend=0.4), linetype=2) +
  annotate("text", x = 25 , y=0.5, label="Text 1")+
  scale_y_continuous(expand=c(0,0), limits = c(0,1)) +
  scale_x_continuous(limits = c(20, 32)) +
  theme_minimal() + theme(line=element_blank(),
  text=element_blank(),
  panel.background=element_blank())

# extract the panel only
gl <- gtable_filter(ggplotGrob(plegend), "panel")

# And draw both
g <- ggplotGrob(p)
g <- gtable_add_rows(x = g, heights = unit(2, "cm"), pos = 0)
g <- gtable_add_grob(g, gl, t = 2, l=4, b=1, r=4)
grid.newpage()
grid.draw(g)



Le 24/10/2016 à 13:08, Marc Girondot via R-help a écrit :

Hello everybody,

Using ggplot2 package, is there a way to force to stop the y-axis line 
at a specified point ? (not using ylim because I want that some text 
written using annotate() at the top of the graph is still shown).


Bellow is a simple example to show what I would like do:

Thanks a lot

Marc





library("ggplot2")

g <- ggplot()+
  geom_point(aes(x=c(20, 29, 32), y=c(0, 0.4, 1)))+
  scale_y_continuous(breaks=c(0, 0.25, 0.5, 0.75, 1))+
  labs(x="Label for x axis")+
  labs(y="Label for y axis") +
  annotate("text", x = 25 , y=1.2, label="Text 1")+
  annotate("text", x = 22 , y=1.0, label="How to stop the y-axis line 
here !")+

  geom_segment(aes(x=25, xend=25, y=0, yend=1.1), linetype=2)+
  # This part is just to make it more nice
  theme(panel.background = element_rect(fill = 'white'),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
plot.margin = unit(c(0.5, 1, 0.5, 0.5), "cm"),
axis.text.x=element_text(size=14),
axis.text.y=element_text(size=14),
axis.title.x=element_text(size=18),
axis.title.y=element_text(size=18),
axis.ticks.length=unit(0.3,"cm"),
panel.border = element_blank(),
axis.line.x = element_line(),
axis.line.y = element_line())
g

__
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.




--
__
Marc Girondot, Pr

Laboratoire Ecologie, Systématique et Evolution
Equipe de Conservation des Populations et des Communautés
CNRS, AgroParisTech et Université Paris-Sud 11 , UMR 8079
Bâtiment 362
91405 Orsay Cedex, France

Tel:  33 1 (0)1.69.15.72.30   Fax: 33 1 (0)1.69.15.73.53
e-mail: marc.giron...@u-psud.fr
Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html
Skype: girondot

__
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] Finding starting values for the parameters using nls() or nls2()

2016-10-25 Thread Pinglei Gao
Dear Dave
Thanks for your kindness help. I am sorry, I am on a filed survey these days. I 
did not check my email for a long time. Please forgive me for the 
misunderstanding brought to you. Your answer works well for the model: 
Retention = exp (b0*exp (b1*Area^th)). Could you find the starting values for 
the another model: Retention = (b0*Area^(th+1))^b with the same data for me. I 
also asked the same question on R-help list before.

Bests,

PG

-邮件原件-
发件人: dave fournier [mailto:da...@otter-rsch.com] 
发送时间: 2016年10月20日 5:47
收件人: r-help@r-project.org; gaoping...@163.com
主题: Re: [R] Finding starting values for the parameters using nls() or nls2()

Actually this converges very nicely if you use these starting values that I 
obtained with AD Model Builder

th 9.1180e-01
b05.2104e+00
b1   -4.6725e-04

The R result looks like

nls.m2
Nonlinear regression model
   model: Retention ~ expFct(Area, b0, b1, th)
data: structure(list(Area = c(521.5, 689.78, 1284.71, 2018.8, 2560.46, 
524.91, 989.05, 1646.32, 2239.65, 2972.96, 478.54, 875.52, 1432.5, 2144.74, 
2629.2), Retention = c(95.3, 87.18, 44.94, 26.36, 18.12, 84.68, 37.24, 33.04, 
23.46, 9.72, 97.92, 71.44, 44.52, 24.44, 15.26)), .Names = c("Area", 
"Retention"), row.names = c(NA, -15L), class = "data.frame")
 b0 b1 th
  5.2104466 -0.0004672  0.9118029
  residual sum-of-squares: 686.8

Number of iterations to convergence: 1
Achieved convergence tolerance: 1.75e-06

__
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: control panel extent on device

2016-10-25 Thread Ben Tupper
Thanks, Bert.

I have used latticeExtra for layering graphics.  I'm not sure how I would use 
it to align graphics rather superimposing them.

I shall look into the the custom panel plot but that is very new territory for 
me.

Ben

> On Oct 25, 2016, at 9:13 AM, Bert Gunter  wrote:
> 
> Write a custom panel function for levelplot() that calls panel.xyplot after 
> panel.levelplot. I believe this can also be done by the +  operator of the 
> latticeExtra package.
> 
> You do *not* want to call xyplot after levelplot, as that completely redraws 
> the plot.
> 
> Cheers,
> Bert
> 
> 
> On Oct 25, 2016 2:55 PM, "Ben Tupper"  > wrote:
> Hello,
> 
> I am drawing a levelplot and an xyplot on a single device as shown in the 
> runnable example below.  I would like the x axes to align - that is for them 
> to cover the same extent left-to-right on the device. How do I go about doing 
> that?
> 
> ###
> # START
> ###
> library(lattice)
> 
> d <- dim(volcano)
> xy <- data.frame(x = 1:d[1], y = volcano[,30] )
> 
> vol_p <- levelplot(volcano)
> xy_p <- xyplot(y ~ x, data = xy)
> 
> print(vol_p, split = c(1, 2, 1, 2), more = TRUE)
> print(xy_p,  split = c(1, 1, 1, 2), more = FALSE)
> ##
> #END
> ##
> 
> 
> Thanks!
> Ben
> 
> 
> > sessionInfo()
> R version 3.3.1 (2016-06-21)
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> Running under: OS X 10.11.6 (El Capitan)
> 
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
> 
> other attached packages:
> [1] lattice_0.20-33
> 
> loaded via a namespace (and not attached):
> [1] tools_3.3.1 grid_3.3.1
> 
> 
> 
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org 
> 
> __
> 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.
> 

Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org




[[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] lattice: control panel extent on device

2016-10-25 Thread Ben Tupper
Hello,

I am drawing a levelplot and an xyplot on a single device as shown in the 
runnable example below.  I would like the x axes to align - that is for them to 
cover the same extent left-to-right on the device. How do I go about doing that?

###
# START
###
library(lattice)

d <- dim(volcano)
xy <- data.frame(x = 1:d[1], y = volcano[,30] )

vol_p <- levelplot(volcano)
xy_p <- xyplot(y ~ x, data = xy)

print(vol_p, split = c(1, 2, 1, 2), more = TRUE)
print(xy_p,  split = c(1, 1, 1, 2), more = FALSE)
##
#END
##


Thanks!
Ben


> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.6 (El Capitan)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] lattice_0.20-33

loaded via a namespace (and not attached):
[1] tools_3.3.1 grid_3.3.1 



Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

__
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 in a regression

2016-10-25 Thread Michael Dewey

Dear Andrea

At a guess you are trying to add variables to your model in some 
automatic way but since your model is already perfect the unnamed 
function you are using is telling you that you gave it an impossible task.


On 24/10/2016 16:54, Andrea Marcela Huerfano Barbosa wrote:

Hi guys,
When I try to do a linear regression into the console appears this warning
message:


* attempting model selection on an essentially perfect fit is nonsense*


Some one could tell me what does it mean and maybe a way to solve it.

Thanks in advance,

Andrea Marcela

[[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.



--
Michael
http://www.dewey.myzen.co.uk/home.html

__
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.