Re: [R] rnaturalearth: detail by degrees

2018-11-11 Thread Ferri Leberl
Dear Jim,
Thank you for your help.
Meanwhile I found a solution that works about like this:
 
library(rnaturalearth)
mittex<--59.75#central meridian
mittey<--62.316667#central latitude
band<-2#halve edge length of the depicted square, in degrees
map<-ne_countries(scale=10)#the source map
if(require(sp)){plot(map,ylim=c(mittey-band,mittey+band),xlim=c(mittex-band,mittex+band))}#plot
 the map
#Now plot the path with lines(). The points are described by their geocoords.

Yours, Ferri
 
 
 

Gesendet: Sonntag, 04. November 2018 um 22:41 Uhr
Von: "Jim Lemon" 
An: "Ferri Leberl" 
Cc: "r-help mailing list" 
Betreff: Re: [R] rnaturalearth: detail by degrees
Hi Ferri,
One way is to snip out a Google Maps image of the area you want, then
using the "maps" package, start a plot bounded by the corner
coordinates of your Google Maps image. You can get those by clicking
on the corners of the area that you selected. Then use the
"readbitmap" package to create a raster object of your GM image and
display it on the plot made by "map". Finally, use either "points" or
"lines" to display the coordinates of your path.

Jim

On Sat, Nov 3, 2018 at 8:43 PM Ferri Leberl  wrote:
>
>
> Dear all,
> I have the graph of a path, walking a number of places specified by name, 
> logitude and latitude – thanks to Don MacQueen.
> xliam and ylim define a certain section of the earth.
> How can I put this section of a political map into the background?
> Thank you in advance.
> Yours, Ferri
>
>
> __
> 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[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] Line with linearly changing thickness

2018-11-11 Thread Ferri Leberl


Dear All,
I want to depict flows: At point x there is an input of a units. at point y, b 
units arrive.
Obviously, the line thicknes can be manipulated with (a constant) cex. But I 
want the thickness to change linearly from ~a in x to ~b in y.
Is there an out of the box solution for this?
Thank you in advance!
Yours, Ferri

__
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] summary function did not work with multcomp with 27 comparisons

2018-11-11 Thread Michael Dewey

Dear Richard

If you look in the R-help archives you will find that Gerrit Eichner 
suggested that you might need to be more patient. Try using increasing 
numbers of comparisons from 4 and plot time taken against n of 
comparisons then extrapolate to 27.


Michael

On 11/11/2018 00:51, Friedman, Richard A. wrote:

Dear List.

I submitted this inquiry on Thursday but it bounced because I wasn;s a memeber 
under my current e-mail address; I since joined, but did not receive Friday's 
issue. So
please excuse me if you have seen this query before.

I ran multcomp with 27 comparisons. The glht command returned an mcp object,
but the summary command with the Westfall correction ddi not give a summary.
When I ran the same dataset with 4 comparisons I got p-values. When I sued a 
summary with
univariate or Bonferroni�s method with all 27 comarisons I got p-values. But 
all 27 did not
work for Wesrfall. Please advise.
Here is a record of my session with 27 comparisons and Westfall:

R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

   Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[R.app GUI 1.70 (7543) x86_64-apple-darwin15.6.0]

[History restored from /Users/friedman/.Rapp.history]

objc[31790]: Class FIFinderSyncExtensionHost is implemented in both 
/System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit 
(0x7fff9c2b7c90) and 
/System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride
 (0x119bf8cd8). One of the two will be used. Which one is undefined.

library(multcomp)

Loading required package: mvtnorm
Loading required package: survival
Loading required package: TH.data
Loading required package: MASS

Attaching package: �TH.data�

The following object is masked from �package:MASS�:

 geyser


tumor<-read.table("a8_1wayall_input.txt",sep="\t",header=T)
class(tumor)

[1] "data.frame"

dim(tumor)

[1] 309   2

tumor[1,]

  condition  log2vol
1 aa.vector.4w 7.297375


model<-lm(log2vol~condition,data=tumor)
summary(model)


Call:
lm(formula = log2vol ~ condition, data = tumor)

Residuals:
Min 1Q Median 3QMax
-7.997 -2.414  0.291  2.164  8.059

Coefficients:
  Estimate Std. Error t value Pr(>|t|)
(Intercept)   4.587760.60457   7.588  4.3e-13 ***
conditionab.vector.6w 1.398180.85499   1.635 0.103054
conditionac.vector.8w 2.890850.85499   3.381 0.000820 ***
conditionba.dnmt1kd.4w   -2.674910.84733  -3.157 0.001760 **
conditionbb.dnmt1kd.6w   -1.433900.84733  -1.692 0.091654 .
conditionbc.dnmt1kd.8w   -0.471880.84733  -0.557 0.578020
conditionca.dnmt3bkd.4w  -3.153250.89139  -3.537 0.000469 ***
conditioncb.dnmt3bkd.6w  -2.173340.89139  -2.438 0.015355 *
conditioncc.dnmt3bkd.8w  -1.501870.89139  -1.685 0.093078 .
conditionda.dnmt1kdhrad9.4w   1.081531.08991   0.992 0.321863
conditiondb.dnmt1kdhrad9.6w   2.383831.08991   2.187 0.029517 *
conditiondc.dnmt1kdhrad9.8w   3.539901.08991   3.248 0.001297 **
conditionea.dnmt3bkdhrad9.4w  0.027951.06049   0.026 0.978991
conditioneb.dnmt3bkdhrad9.6w  1.340371.06049   1.264 0.207263
conditionec.dnmt3bkdhrad9.8w  3.409551.06049   3.215 0.001449 **
---
Signif. codes:  0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1

Residual standard error: 3.141 on 294 degrees of freedom
Multiple R-squared:  0.3155, Adjusted R-squared:  0.2829
F-statistic: 9.678 on 14 and 294 DF,  p-value: < 2.2e-16


model.mc<-glht(model,linfct=mcp(condition=c("ab.vector.6w-aa.vector.4w=0",

+"ac.vector.8w-aa.vector.4w=0",
+"ac.vector.8w-ab.vector.6w=0",
+   "bb.dnmt1kd.6w-ba.dnmt1kd.4w=0",
+"bc.dnmt1kd.8w-ba.dnmt1kd.4w=0",
+"bc.dnmt1kd.8w-bb.dnmt1kd.6w=0",
+ "cb.dnmt3bkd.6w-ca.dnmt3bkd.4w=0",
+"cc.dnmt3bkd.8w-ca.dnmt3bkd.4w=0",
+"cc.dnmt3bkd.8w-cb.dnmt3bkd.6w=0",
+ "db.dnmt1kdhrad9.6w-da.dnmt1kdhrad9.4w=0",
+"dc.dnmt1kdhrad9.8w-da.dnmt1kdhrad9.4w=0",
+"dc.dnmt1kdhrad9.8w-db.dnmt1kdhrad9.6w=0",
+ "eb.dnmt3bkdhrad9.6w-ea.dnmt3bkdhrad9.4w=0",
+"ec.dnmt3bkdhrad9.8w-ea.dnmt3bkdhrad9.4w=0

Re: [R] Line with linearly changing thickness

2018-11-11 Thread Peter Dalgaard
Hmm... I don't recall whether this has been packaged up, but Paul Murrell 
talked about it at useR in Brisbane. 

https://www.youtube.com/watch?v=L6FawdEA3W0

-pd

> On 11 Nov 2018, at 11:44 , Ferri Leberl  wrote:
> 
> 
> Dear All,
> I want to depict flows: At point x there is an input of a units. at point y, 
> b units arrive.
> Obviously, the line thicknes can be manipulated with (a constant) cex. But I 
> want the thickness to change linearly from ~a in x to ~b in y.
> Is there an out of the box solution for this?
> Thank you in advance!
> Yours, Ferri
> 
> __
> 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.

-- 
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] Line with linearly changing thickness – installation issues

2018-11-11 Thread Ferri Leberl
Dear All,
Thanks to Peter for his hint to the lwline package.
As a pitty, I have difficulties to get it installed, as it requires 
https://github.com/Gibbsdavidl/twine which failes for me.

install_github("g...@github.com:Gibbsdavidl/twine.git")
 
ends with

** building package indices
Error in read.table(zfile, header = TRUE, as.is = FALSE) : 
  more columns than column names
ERROR: installing package indices failed
* removing ‘/usr/local/lib/R/site-library/twine’
Fehler in i.p(...) : 
  (konvertiert von Warnung) installation of package 
‘/tmp/RtmpD3exKe/file730c303b4c3/twine_0.1.tar.gz’ had non-zero exit status

I found hints like
https://community.rstudio.com/t/lazydata-failed-for-for-package/4196 and
https://stat.ethz.ch/pipermail/r-help/2011-March/272829.html
that boil down to problems within the data subdir of the project – but I cannot 
(and should not) edit the project, can I?

Can anybody help me solving the problem?
Thank you in advance!
Yours, Ferri

 

Gesendet: Sonntag, 11. November 2018 um 15:38 Uhr
Von: "Peter Dalgaard" 
An: "Ferri Leberl" 
Cc: r-help@r-project.org
Betreff: Re: [R] Line with linearly changing thickness
Hmm... I don't recall whether this has been packaged up, but Paul Murrell 
talked about it at useR in Brisbane.

https://www.youtube.com/watch?v=L6FawdEA3W0

-pd

> On 11 Nov 2018, at 11:44 , Ferri Leberl  wrote:
>
>
> Dear All,
> I want to depict flows: At point x there is an input of a units. at point y, 
> b units arrive.
> Obviously, the line thicknes can be manipulated with (a constant) cex. But I 
> want the thickness to change linearly from ~a in x to ~b in y.
> Is there an out of the box solution for this?
> Thank you in advance!
> Yours, Ferri
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help[https://stat.ethz.ch/mailman/listinfo/r-help]
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html[http://www.R-project.org/posting-guide.html]
> and provide commented, minimal, self-contained, reproducible code.

--
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] Line with linearly changing thickness – installation issues

2018-11-11 Thread David Winsemius
I would have imagined that drawing a polygon would be the way most 
people would have attempted.


Regarding Murrell's package:

I thought the package name was "vwline". My attempt to install was 
unsuccessful>


> devtools::install_github("pmur002/vwline")
Error in utils::download.file(url, path, method = download_method(), 
quiet = quiet,  :
  cannot open URL 
'https://api.github.com/repos/pmur002/vwline/contents/DESCRIPTION?ref=master'

> install.packages("~/vwline-0.2-1.tar.gz", repo=NULL)
Installing package into ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’
(as ‘lib’ is unspecified)
Warning in untar2(tarfile, files, list, exdir, restore_times) :
  skipping pax global extended headers
ERROR: cannot extract package from ‘/home/david/vwline-0.2-1.tar.gz’
Warning in install.packages :
  installation of package ‘/home/david/vwline-0.2-1.tar.gz’ had 
non-zero exit status



Furthermore, I do get the same error from attempting to install 
pkg:twine from github.


-- David

Doing this from an Rstudio console running R 3.5.1 in Ubuntu 18.04

On 11/11/18 8:30 AM, Ferri Leberl wrote:

Dear All,
Thanks to Peter for his hint to the lwline package.
As a pitty, I have difficulties to get it installed, as it requires 
https://github.com/Gibbsdavidl/twine which failes for me.

install_github("g...@github.com:Gibbsdavidl/twine.git")
  
ends with


** building package indices
Error in read.table(zfile, header = TRUE, as.is = FALSE) :
   more columns than column names
ERROR: installing package indices failed
* removing ‘/usr/local/lib/R/site-library/twine’
Fehler in i.p(...) :
   (konvertiert von Warnung) installation of package 
‘/tmp/RtmpD3exKe/file730c303b4c3/twine_0.1.tar.gz’ had non-zero exit status

I found hints like
https://community.rstudio.com/t/lazydata-failed-for-for-package/4196 and
https://stat.ethz.ch/pipermail/r-help/2011-March/272829.html
that boil down to problems within the data subdir of the project – but I cannot 
(and should not) edit the project, can I?

Can anybody help me solving the problem?
Thank you in advance!
Yours, Ferri

  


Gesendet: Sonntag, 11. November 2018 um 15:38 Uhr
Von: "Peter Dalgaard" 
An: "Ferri Leberl" 
Cc: r-help@r-project.org
Betreff: Re: [R] Line with linearly changing thickness
Hmm... I don't recall whether this has been packaged up, but Paul Murrell 
talked about it at useR in Brisbane.

https://www.youtube.com/watch?v=L6FawdEA3W0

-pd


On 11 Nov 2018, at 11:44 , Ferri Leberl  wrote:


Dear All,
I want to depict flows: At point x there is an input of a units. at point y, b 
units arrive.
Obviously, the line thicknes can be manipulated with (a constant) cex. But I 
want the thickness to change linearly from ~a in x to ~b in y.
Is there an out of the box solution for this?
Thank you in advance!
Yours, Ferri

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

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


__
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] Line with linearly changing thickness – installation issues

2018-11-11 Thread Fox, John
Dear David and Ferri,

Here's a simple implementation using polygon() (as David suggested). It's much 
less sophisticated than Paul Murrell's -- in particular, the ends of the line 
are simply vertical (but, with a bit more work, that too could be addressed) -- 
and uses standard R graphics rather than grid.

tline <- function(x, y, thickness, col="black", unit=0.005){
# line of varying thickness
#   x: vector of x coordinates
#   y: vector of y coordinates
#   thickness: units of thickness at each set of coordinates
#   col: line colour
#   unit: unit of thickness as fraction of vertical axis
tl <- function(x1, x2, y1, y2, start, end){
polygon(x=c(x1, x1, x2, x2, x1), 
y=c(y1 - start*units, y1 + start*units, 
y2 + end*units, y2 - end*units, 
y1 - start*units),
col=col, border=col)
}
if (length(x) != length(y)) "x and y are of different lengths"
if (length(x) != length(thickness)) 
"length of thickness is different from x and y"
if (length(x) < 2) "x and y are too short"
usr <- par("usr")
units <- (usr[4] - usr[3])*unit/2
for (i in 2:length(x)){
tl(x[i - 1], x[i], y[i - 1], y[i], thickness[i - 1], thickness[i])
}
}

# example:

plot(c(-1, 1), c(0, 100), type="n")
tline(seq(-1, 1, by=0.1), y=(seq(1, 9.5, length=21))^2, 
  thickness=seq(1, 20, length=21), col="blue")

I hope this helps,
 John

--
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
Web: socialsciences.mcmaster.ca/jfox/



> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David
> Winsemius
> Sent: Sunday, November 11, 2018 12:23 PM
> To: r-help@r-project.org
> Subject: Re: [R] Line with linearly changing thickness – installation
> issues
> 
> I would have imagined that drawing a polygon would be the way most
> people would have attempted.
> 
> Regarding Murrell's package:
> 
> I thought the package name was "vwline". My attempt to install was
> unsuccessful>
> 
>  > devtools::install_github("pmur002/vwline")
> Error in utils::download.file(url, path, method = download_method(),
> quiet = quiet,  :
>    cannot open URL
> 'https://api.github.com/repos/pmur002/vwline/contents/DESCRIPTION?ref=ma
> ster'
>  > install.packages("~/vwline-0.2-1.tar.gz", repo=NULL) Installing
> package into ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’
> (as ‘lib’ is unspecified)
> Warning in untar2(tarfile, files, list, exdir, restore_times) :
>    skipping pax global extended headers
> ERROR: cannot extract package from ‘/home/david/vwline-0.2-1.tar.gz’
> Warning in install.packages :
>    installation of package ‘/home/david/vwline-0.2-1.tar.gz’ had non-
> zero exit status
> 
> 
> Furthermore, I do get the same error from attempting to install
> pkg:twine from github.
> 
> -- David
> 
> Doing this from an Rstudio console running R 3.5.1 in Ubuntu 18.04
> 
> On 11/11/18 8:30 AM, Ferri Leberl wrote:
> > Dear All,
> > Thanks to Peter for his hint to the lwline package.
> > As a pitty, I have difficulties to get it installed, as it requires
> https://github.com/Gibbsdavidl/twine which failes for me.
> >
> > install_github("g...@github.com:Gibbsdavidl/twine.git")
> >
> > ends with
> >
> > ** building package indices
> > Error in read.table(zfile, header = TRUE, as.is = FALSE) :
> >more columns than column names
> > ERROR: installing package indices failed
> > * removing ‘/usr/local/lib/R/site-library/twine’
> > Fehler in i.p(...) :
> >(konvertiert von Warnung) installation of package
> > ‘/tmp/RtmpD3exKe/file730c303b4c3/twine_0.1.tar.gz’ had non-zero exit
> > status
> >
> > I found hints like
> > https://community.rstudio.com/t/lazydata-failed-for-for-package/4196
> > and https://stat.ethz.ch/pipermail/r-help/2011-March/272829.html
> > that boil down to problems within the data subdir of the project – but
> I cannot (and should not) edit the project, can I?
> >
> > Can anybody help me solving the problem?
> > Thank you in advance!
> > Yours, Ferri
> >
> >
> >
> > Gesendet: Sonntag, 11. November 2018 um 15:38 Uhr
> > Von: "Peter Dalgaard" 
> > An: "Ferri Leberl" 
> > Cc: r-help@r-project.org
> > Betreff: Re: [R] Line with linearly changing thickness Hmm... I don't
> > recall whether this has been packaged up, but Paul Murrell talked
> about it at useR in Brisbane.
> >
> > https://www.youtube.com/watch?v=L6FawdEA3W0
> >
> > -pd
> >
> >> On 11 Nov 2018, at 11:44 , Ferri Leberl  wrote:
> >>
> >>
> >> Dear All,
> >> I want to depict flows: At point x there is an input of a units. at
> point y, b units arrive.
> >> Obviously, the line thicknes can be manipulated with (a constant)
> cex. But I want the thickness to change linearly from ~a in x to ~b in
> y.
> >> Is there an out of the box solution for this?
> >> Thank you in advance!
> >> Yours, Ferri
> >>
> >> __

Re: [R] Line with linearly changing thickness – installation issues

2018-11-11 Thread Fox, John
And here's a simpler, loopless version:

tlines <- function(x, y, thickness, col="black", unit=0.005){
# line of varying thickness
#   x: vector of x coordinates
#   y: vector of y coordinates
#   thickness: units of thickness at each set of coordinates
#   col: line colour
#   unit: unit of thickness as fraction of vertical axis
if (length(x) != length(y)) "x and y are of different lengths"
if (length(x) != length(thickness)) 
"length of thickness is different from x and y"
if (length(x) < 2) "x and y are too short"
usr <- par("usr")
units <- (usr[4] - usr[3])*unit/2
x <- c(x, rev(x))
y <- c(y + thickness*units, rev(y) - rev(thickness)*units)
polygon(x=x, y=y, col=col, border=col)
}

Best,
 John

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Fox, John
> Sent: Sunday, November 11, 2018 1:30 PM
> To: David Winsemius ; Ferri Leberl
> 
> Cc: r-help@r-project.org
> Subject: Re: [R] Line with linearly changing thickness – installation issues
> 
> Dear David and Ferri,
> 
> Here's a simple implementation using polygon() (as David suggested). It's
> much less sophisticated than Paul Murrell's -- in particular, the ends of the 
> line
> are simply vertical (but, with a bit more work, that too could be addressed) 
> --
> and uses standard R graphics rather than grid.
> 
> tline <- function(x, y, thickness, col="black", unit=0.005){
> # line of varying thickness
> #   x: vector of x coordinates
> #   y: vector of y coordinates
> #   thickness: units of thickness at each set of coordinates
> #   col: line colour
> #   unit: unit of thickness as fraction of vertical axis
> tl <- function(x1, x2, y1, y2, start, end){
> polygon(x=c(x1, x1, x2, x2, x1),
> y=c(y1 - start*units, y1 + start*units,
> y2 + end*units, y2 - end*units,
> y1 - start*units),
> col=col, border=col)
> }
> if (length(x) != length(y)) "x and y are of different lengths"
> if (length(x) != length(thickness))
> "length of thickness is different from x and y"
> if (length(x) < 2) "x and y are too short"
> usr <- par("usr")
> units <- (usr[4] - usr[3])*unit/2
> for (i in 2:length(x)){
> tl(x[i - 1], x[i], y[i - 1], y[i], thickness[i - 1], thickness[i])
> }
> }
> 
> # example:
> 
> plot(c(-1, 1), c(0, 100), type="n")
> tline(seq(-1, 1, by=0.1), y=(seq(1, 9.5, length=21))^2,
>   thickness=seq(1, 20, length=21), col="blue")
> 
> I hope this helps,
>  John
> 
> --
> John Fox, Professor Emeritus
> McMaster University
> Hamilton, Ontario, Canada
> Web: socialsciences.mcmaster.ca/jfox/
> 
> 
> 
> > -Original Message-
> > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David
> > Winsemius
> > Sent: Sunday, November 11, 2018 12:23 PM
> > To: r-help@r-project.org
> > Subject: Re: [R] Line with linearly changing thickness – installation
> > issues
> >
> > I would have imagined that drawing a polygon would be the way most
> > people would have attempted.
> >
> > Regarding Murrell's package:
> >
> > I thought the package name was "vwline". My attempt to install was
> > unsuccessful>
> >
> >  > devtools::install_github("pmur002/vwline")
> > Error in utils::download.file(url, path, method = download_method(),
> > quiet = quiet,  :
> >    cannot open URL
> > 'https://api.github.com/repos/pmur002/vwline/contents/DESCRIPTION?ref=
> > ma
> > ster'
> >  > install.packages("~/vwline-0.2-1.tar.gz", repo=NULL) Installing
> > package into ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’
> > (as ‘lib’ is unspecified)
> > Warning in untar2(tarfile, files, list, exdir, restore_times) :
> >    skipping pax global extended headers
> > ERROR: cannot extract package from ‘/home/david/vwline-0.2-1.tar.gz’
> > Warning in install.packages :
> >    installation of package ‘/home/david/vwline-0.2-1.tar.gz’ had non-
> > zero exit status
> >
> >
> > Furthermore, I do get the same error from attempting to install
> > pkg:twine from github.
> >
> > -- David
> >
> > Doing this from an Rstudio console running R 3.5.1 in Ubuntu 18.04
> >
> > On 11/11/18 8:30 AM, Ferri Leberl wrote:
> > > Dear All,
> > > Thanks to Peter for his hint to the lwline package.
> > > As a pitty, I have difficulties to get it installed, as it requires
> > https://github.com/Gibbsdavidl/twine which failes for me.
> > >
> > > install_github("g...@github.com:Gibbsdavidl/twine.git")
> > >
> > > ends with
> > >
> > > ** building package indices
> > > Error in read.table(zfile, header = TRUE, as.is = FALSE) :
> > >more columns than column names
> > > ERROR: installing package indices failed
> > > * removing ‘/usr/local/lib/R/site-library/twine’
> > > Fehler in i.p(...) :
> > >(konvertiert von Warnung) installation of package
> > > ‘/tmp/RtmpD3exKe/file730c303b4c3/twine_0.1.tar.gz’ had non-zero

Re: [R] [FORGED] Re: Line with linearly changing thickness – installation issues

2018-11-11 Thread Paul Murrell

Hi

This should hopefully work ...

library(devtools); install_github("pmur002/vwline/pkg@v0.1")

You can also do ...

library(devtools); install_github("pmur002/gridBezier@v1.0-0")
library(devtools); install_github("pmur002/vwline/pkg@v0.2-1")

... to get the latest version.

There is more info at ...

https://www.stat.auckland.ac.nz/~paul/Reports/VWline/vwline-intro/power-curve.html

... and even more in several other reports at ...

https://www.stat.auckland.ac.nz/~paul/index.html

Paul

On 12/11/18 6:22 AM, David Winsemius wrote:
I would have imagined that drawing a polygon would be the way most 
people would have attempted.


Regarding Murrell's package:

I thought the package name was "vwline". My attempt to install was 
unsuccessful>


 > devtools::install_github("pmur002/vwline")
Error in utils::download.file(url, path, method = download_method(), 
quiet = quiet,  :
   cannot open URL 
'https://api.github.com/repos/pmur002/vwline/contents/DESCRIPTION?ref=master' 


 > install.packages("~/vwline-0.2-1.tar.gz", repo=NULL)
Installing package into ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’
(as ‘lib’ is unspecified)
Warning in untar2(tarfile, files, list, exdir, restore_times) :
   skipping pax global extended headers
ERROR: cannot extract package from ‘/home/david/vwline-0.2-1.tar.gz’
Warning in install.packages :
   installation of package ‘/home/david/vwline-0.2-1.tar.gz’ had 
non-zero exit status



Furthermore, I do get the same error from attempting to install 
pkg:twine from github.


-- David

Doing this from an Rstudio console running R 3.5.1 in Ubuntu 18.04

On 11/11/18 8:30 AM, Ferri Leberl wrote:

Dear All,
Thanks to Peter for his hint to the lwline package.
As a pitty, I have difficulties to get it installed, as it requires 
https://github.com/Gibbsdavidl/twine which failes for me.


install_github("g...@github.com:Gibbsdavidl/twine.git")
ends with

** building package indices
Error in read.table(zfile, header = TRUE, as.is = FALSE) :
   more columns than column names
ERROR: installing package indices failed
* removing ‘/usr/local/lib/R/site-library/twine’
Fehler in i.p(...) :
   (konvertiert von Warnung) installation of package 
‘/tmp/RtmpD3exKe/file730c303b4c3/twine_0.1.tar.gz’ had non-zero exit 
status


I found hints like
https://community.rstudio.com/t/lazydata-failed-for-for-package/4196 and
https://stat.ethz.ch/pipermail/r-help/2011-March/272829.html
that boil down to problems within the data subdir of the project – but 
I cannot (and should not) edit the project, can I?


Can anybody help me solving the problem?
Thank you in advance!
Yours, Ferri


Gesendet: Sonntag, 11. November 2018 um 15:38 Uhr
Von: "Peter Dalgaard" 
An: "Ferri Leberl" 
Cc: r-help@r-project.org
Betreff: Re: [R] Line with linearly changing thickness
Hmm... I don't recall whether this has been packaged up, but Paul 
Murrell talked about it at useR in Brisbane.


https://www.youtube.com/watch?v=L6FawdEA3W0

-pd


On 11 Nov 2018, at 11:44 , Ferri Leberl  wrote:


Dear All,
I want to depict flows: At point x there is an input of a units. at 
point y, b units arrive.
Obviously, the line thicknes can be manipulated with (a constant) 
cex. But I want the thickness to change linearly from ~a in x to ~b 
in y.

Is there an out of the box solution for this?
Thank you in advance!
Yours, Ferri

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help[https://stat.ethz.ch/mailman/listinfo/r-help] 

PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html[http://www.R-project.org/posting-guide.html] 


and provide commented, minimal, self-contained, reproducible code.

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


__
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: Line with linearly changing thickness – installation issues

2018-11-11 Thread Ferri Leberl
Dear Paul,
Thank you for your help.
With your command, the package got installed immediately.
Yours, Ferri
 



Gesendet: Sonntag, 11. November 2018 um 21:05 Uhr
Von: "Paul Murrell" 
An: "David Winsemius" , r-help@r-project.org
Betreff: Re: [R] [FORGED] Re: Line with linearly changing thickness – 
installation issues
Hi

This should hopefully work ...

library(devtools); install_github("pmur002/vwline/pkg@v0.1")

You can also do ...

library(devtools); install_github("pmur002/gridBezier@v1.0-0")
library(devtools); install_github("pmur002/vwline/pkg@v0.2-1")

... to get the latest version.

There is more info at ...

https://www.stat.auckland.ac.nz/~paul/Reports/VWline/vwline-intro/power-curve.html

... and even more in several other reports at ...

https://www.stat.auckland.ac.nz/~paul/index.html[https://www.stat.auckland.ac.nz/~paul/index.html]

Paul

On 12/11/18 6:22 AM, David Winsemius wrote:
> I would have imagined that drawing a polygon would be the way most
> people would have attempted.
>
> Regarding Murrell's package:
>
> I thought the package name was "vwline". My attempt to install was
> unsuccessful>
>
> > devtools::install_github("pmur002/vwline")
> Error in utils::download.file(url, path, method = download_method(),
> quiet = quiet,  :
>   cannot open URL
> 'https://api.github.com/repos/pmur002/vwline/contents/DESCRIPTION?ref=master'[https://api.github.com/repos/pmur002/vwline/contents/DESCRIPTION?ref=master']
>
> > install.packages("~/vwline-0.2-1.tar.gz", repo=NULL)
> Installing package into ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’
> (as ‘lib’ is unspecified)
> Warning in untar2(tarfile, files, list, exdir, restore_times) :
>   skipping pax global extended headers
> ERROR: cannot extract package from ‘/home/david/vwline-0.2-1.tar.gz’
> Warning in install.packages :
>   installation of package ‘/home/david/vwline-0.2-1.tar.gz’ had
> non-zero exit status
>
>
> Furthermore, I do get the same error from attempting to install
> pkg:twine from github.
>
> -- David
>
> Doing this from an Rstudio console running R 3.5.1 in Ubuntu 18.04
>
> On 11/11/18 8:30 AM, Ferri Leberl wrote:
>> Dear All,
>> Thanks to Peter for his hint to the lwline package.
>> As a pitty, I have difficulties to get it installed, as it requires
>> https://github.com/Gibbsdavidl/twine[https://github.com/Gibbsdavidl/twine] 
>> which failes for me.
>>
>> install_github("g...@github.com:Gibbsdavidl/twine.git")
>> ends with
>>
>> ** building package indices
>> Error in read.table(zfile, header = TRUE, as.is = FALSE) :
>>    more columns than column names
>> ERROR: installing package indices failed
>> * removing ‘/usr/local/lib/R/site-library/twine’
>> Fehler in i.p(...) :
>>    (konvertiert von Warnung) installation of package
>> ‘/tmp/RtmpD3exKe/file730c303b4c3/twine_0.1.tar.gz’ had non-zero exit
>> status
>>
>> I found hints like
>> https://community.rstudio.com/t/lazydata-failed-for-for-package/4196[https://community.rstudio.com/t/lazydata-failed-for-for-package/4196]
>>  and
>> https://stat.ethz.ch/pipermail/r-help/2011-March/272829.html[https://stat.ethz.ch/pipermail/r-help/2011-March/272829.html]
>> that boil down to problems within the data subdir of the project – but
>> I cannot (and should not) edit the project, can I?
>>
>> Can anybody help me solving the problem?
>> Thank you in advance!
>> Yours, Ferri
>>
>>
>> Gesendet: Sonntag, 11. November 2018 um 15:38 Uhr
>> Von: "Peter Dalgaard" 
>> An: "Ferri Leberl" 
>> Cc: r-help@r-project.org
>> Betreff: Re: [R] Line with linearly changing thickness
>> Hmm... I don't recall whether this has been packaged up, but Paul
>> Murrell talked about it at useR in Brisbane.
>>
>> https://www.youtube.com/watch?v=L6FawdEA3W0[https://www.youtube.com/watch?v=L6FawdEA3W0]
>>
>> -pd
>>
>>> On 11 Nov 2018, at 11:44 , Ferri Leberl  wrote:
>>>
>>>
>>> Dear All,
>>> I want to depict flows: At point x there is an input of a units. at
>>> point y, b units arrive.
>>> Obviously, the line thicknes can be manipulated with (a constant)
>>> cex. But I want the thickness to change linearly from ~a in x to ~b
>>> in y.
>>> Is there an out of the box solution for this?
>>> Thank you in advance!
>>> Yours, Ferri
>>>
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help[https://stat.ethz.ch/mailman/listinfo/r-help][https://stat.ethz.ch/mailman/listinfo/r-help[https://stat.ethz.ch/mailman/listinfo/r-help]]
>>>
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html[http://www.R-project.org/posting-guide.html][http://www.R-project.org/posting-guide.html[http://www.R-project.org/posting-guide.html]]
>>>
>>> and provide commented, minimal, self-contained, reproducible code.
>> --
>> Peter Dalgaard, Professor,
>> Center for Statistics, Copenhagen Business School
>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>> Phone: (+45)38153501
>> Office: A 4.23
>> Email: p

[R] Reporting binomial logistic regression from R results

2018-11-11 Thread Frodo Jedi
Dear list members,
I need some help in understanding whether I am doing correctly a binomial
logistic regression and whether I am interpreting the results in the
correct way. Also I would need an advice regarding the reporting of the
results from the R functions.

I want to report the results of a binomial logistic regression where I want
to assess difference between the 3 levels of a factor (called System) on
the dependent variable (called Response) taking two values, 0 and 1. My
goal is to understand if the effect of the 3 systems (A,B,C) in System
affect differently Response in a significant way. I am basing my analysis
on this URL: https://stats.idre.ucla.edu/r/dae/logit-regression/

This is the result of my analysis:

> fit <- glm(Response ~ System, data = scrd, family = "binomial")
> summary(fit)

Call:
glm(formula = Response ~ System, family = "binomial", data = scrd)

Deviance Residuals:
Min   1Q   Median   3Q  Max
-2.8840   0.1775   0.2712   0.2712   0.5008

Coefficients:
 Estimate Std. Error z value Pr(>|z|)
(Intercept)3.2844 0.2825  11.626  < 2e-16 ***
SystemB  -1.2715 0.3379  -3.763 0.000168 ***
SystemC0.8588 0.4990   1.721 0.085266 .
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 411.26  on 1023  degrees of freedom
Residual deviance: 376.76  on 1021  degrees of freedom
AIC: 382.76

Number of Fisher Scoring iterations: 6
Following this analysis I perform the wald test in order to understand
whether there is an overall effect of System:

library(aod)

> wald.test(b = coef(fit), Sigma = vcov(fit), Terms = 1:3)
Wald test:
--

Chi-squared test:
X2 = 354.6, df = 3, P(> X2) = 0.0
The chi-squared test statistic of 354.6, with 3 degrees of freedom is
associated with a p-value < 0.001 indicating that the overall effect of
System is statistically significant.

Now I check whether there are differences between the coefficients using
again the wald test:

# Here difference between system B and C:

> l <- cbind(0, 1, -1)
> wald.test(b = coef(fit), Sigma = vcov(fit), L = l)
Wald test:
--

Chi-squared test:
X2 = 22.3, df = 1, P(> X2) = 2.3e-06



# Here difference between system A and C:

> l <- cbind(1, 0, -1)
> wald.test(b = coef(fit), Sigma = vcov(fit), L = l)
Wald test:
--

Chi-squared test:
X2 = 12.0, df = 1, P(> X2) = 0.00052



# Here difference between system A and B:

> l <- cbind(1, -1, 0)
> wald.test(b = coef(fit), Sigma = vcov(fit), L = l)
Wald test:
--

Chi-squared test:
X2 = 58.7, df = 1, P(> X2) = 1.8e-14

My understanding is that from this analysis I can state that the three
systems lead to a significantly different Response. Am I right? If so, how
should I report the results of this analysis? What is the correct way?


Thanks in advance

Best wishes

FJ

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