goranbrostrom / eha

eha
6 stars 1 forks source link

Error: weibsup not available / phsup no available #1

Closed ghost closed 4 years ago

ghost commented 6 years ago

Hi,

When I run the code line: weibull.model0 <- weibreg(Surv(day, event)~strata(wood)+(familiarsexnsites), data=sqsurv.data, shape=0)

I get the following error: Error in .C("weibsup", iter = as.integer(iter), as.double(control$eps), : "weibsup" not available for .C() for package "eha"

The eha library is present and loaded, and the R script as a whole worked perfectly with earlier versions of R and eha (I am now on R 3.4.3 "Kite-Eating Tree"). I have updated eha as well as R.

I note that you planned eventually to abandon eha::weibreg(), because the Weibull distribution is included in eha::phreg - but changing the code to: weibull.model0 <- weibreg(Surv(day, event)~strata(wood)+(familiarsexnsites), data=sqsurv.data, shape=0) ...gives a similar error: Error in .C("phsup", iter = as.integer(iter), as.double(control$eps), : "phsup" not available for .C() for package "eha"

Would greatly appreciate help!

goranbrostrom commented 6 years ago

That's really weird: I see nothing like that on my end. Could you send the output from 'sessionInfo()'? However,I googled your error message (a good habit!) and got a few hits: The advise was to reinstall 'eha' after upgrading R to 3.4.3, maybe with

update.packages(checkBuilt = TRUE)

or

install.packages("eha", checkBuilt = TRUE)

Göran

ghost commented 6 years ago

Dear Göran, Thanks for your really swift response! Session info attached, also the R script file that fails.

Following a decision in our institution to restrict local admin rights, R on my laptop has been having problems accessing its libraries, both when connected to our network and off-line. So this might be a related issue. However, following your reply, I have deleted and reinstalled both R 3.4.3 and my entire R library, and R seems to be finding all extra libraries OK, including eha - but it gets stuck on this “weibsup” issue. As I mentioned, I am pretty certain my script is unaltered from 12 months ago, when it ran fine on the same data file.

In another script written 2 days ago, R creates a weibreg object OK (i.e. it seems to get past that weibsup hurdle), but then fails to find the function eha::plot.weibreg(): … weibull.model1 <- weibreg(Surv(day, event)~siteyear, data=sqreenc.data, shape=0) weibull.model3 <- weibreg(Surv(day, event)~strata(siteyear), data=sqreenc.data, shape=0) … plot.weibreg(weibull.model1, fn="haz", main="instantaneous hazard curves",xlab = "days",ylab="hazard function",xlim=c(0,40), ylim=c(0,0.3), yaxp=c(0,0.3,3), xaxs="r", yaxs="r", col="mediumvioletred", lwd=2, bty="n") par(new=T) plot.weibreg(weibull.model3, fn="haz", main="", xlab="",ylab="",lwd=2, xlim=c(0,40), ylim=c(0,0.3), col="olivedrab4", xaxs="r", yaxs="r", xaxt="n", yaxt="n") … This results in <<“Error in plot.weibreg(weibull.model1, fn = "haz", main = "instantaneous hazard curves", : could not find function "plot.weibreg">>

Many thanks for your time and help. I’m fully prepared to learn that this is caused by some stupidity on my part, but I just can’t see it!

Jonathan

Dr Jonathan C. Reynolds Game & Wildlife Conservation Trust Burgate Manor Fordingbridge Hampshire SP6 1EF UK

Email: jreynolds@gwct.org.ukmailto:jreynolds@gwct.org.uk Website: www.gwct.org.ukhttp://www.gwct.org.uk/ Publications: http://scholar.google.co.uk/citations?user=CPLe7WAAAAAJ&hl=en Phone: +44(0)1425 652381 (switchboard) +44(0)1425 651033 (direct line) +44(0)7824 150507 (mobile)

From: Göran Broström [mailto:notifications@github.com] Sent: 19 January 2018 12:35 To: goranbrostrom/eha eha@noreply.github.com Cc: Jonathan Reynolds jreynolds@gwct.org.uk; Author author@noreply.github.com Subject: Re: [goranbrostrom/eha] Error: weibsup not available / phsup no available (#1)

That's really weird: I see nothing like that on my end. Could you send the output from 'sessionInfo()'? However,I googled your error message (a good habit!) and got a few hits: The advise was to reinstall 'eha' after upgrading R to 3.4.3, maybe with

update.packages(checkBuilt = TRUE)

or

install.packages("eha", checkBuilt = TRUE)

Göran

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/goranbrostrom/eha/issues/1#issuecomment-358955028, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJyUa9nCtpElSxcqpq81x-B3JKHSVa8sks5tMIvygaJpZM4RkUb9.


[The Game & Wildlife Conservation Trust is accredited by Investors In People]

This communication from the Game & Wildlife Conservation Trust contains information which is confidential and may also be privileged. It is for the exclusive use of the addressee. If you are not the addressee please note that any distribution, copying or use of this communication or the information in it is prohibited. If you have received this communication in error, please telephone us immediately to arrange for its return.

The Game & Wildlife Conservation Trust is a charitable company limited by guarantee registered in England and Wales under number 05579632, registered charity number 1112023 (England and Wales) and SC038868 (Scotland). VAT Reg 665 2959 92. Registered Office: Burgate Manor, Fordingbridge, Hampshire SP6 1EF Tel: +44(0)1425 652381. Email: info@gwct.org.uk Web: www.gwct.org.uk Registered Office: Burgate Manor, Fordingbridge, Hampshire SP6 1EF Game & Wildlife Conservation Trading is a company limited by guarantee (registered no 1503620, VAT Reg No 323 7013 94.) which carries out trading and advisory activities and some fundraising events for the Game & Wildlife Conservation Trust.

Registered in England and Wales. Registered Office: Burgate Manor, Fordingbridge, Hampshire SP6 1EF

R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (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.

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.

[Workspace loaded from C:/Users/jreynolds/Desktop/.RData]

source('//gwctfile02/predation/Publications/Chettle Head Copse Squirrels/sqsurvival.R') Loading required package: survival Loading required package: KMsurv

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

filter, lag

The following objects are masked from ‘package:base’:

intersect, setdiff, setequal, union

data.table 1.10.4.3 The fastest way to learn (by data.table authors): https://www.datacamp.com/courses/data-analysis-the-data-table-way Documentation: ?data.table, example(data.table) and browseVignettes("data.table") Release notes, videos and slides: http://r-datatable.com

Attaching package: ‘data.table’

The following objects are masked from ‘package:dplyr’:

between, first, last

survMisc 0.5.4 List of 13 $ n : int 59 $ time : num [1:21] 1 2 3 4 5 6 7 9 10 13 ... $ n.risk : num [1:21] 59 50 43 34 31 30 29 27 26 25 ... $ n.event : num [1:21] 9 7 9 3 1 1 2 1 1 1 ... $ n.censor : num [1:21] 0 0 0 0 0 0 0 0 0 0 ... $ surv : num [1:21] 0.847 0.729 0.576 0.525 0.508 ... $ type : chr "right" $ std.err : num [1:21] 0.0552 0.0794 0.1116 0.1237 0.128 ... $ upper : num [1:21] 0.944 0.852 0.717 0.67 0.653 ... $ lower : num [1:21] 0.761 0.624 0.463 0.412 0.396 ... $ conf.type: chr "log" $ conf.int : num 0.95 $ call : language survfit(formula = allsqs.object ~ 1)

Matrix products: default

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

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

other attached packages: [1] bindrcpp_0.2 survMisc_0.5.4 stringr_1.2.0 data.table_1.10.4-3 dplyr_0.7.4 eha_2.5.1
[7] OIsurv_0.2 KMsurv_0.1-5 survival_2.41-3

loaded via a namespace (and not attached): [1] Rcpp_0.12.14 km.ci_0.5-2 knitr_1.18 bindr_0.1 magrittr_1.5 splines_3.4.3 munsell_0.4.3
[8] xtable_1.8-2 colorspace_1.3-2 lattice_0.20-35 R6_2.2.2 rlang_0.1.6 plyr_1.8.4 tools_3.4.3
[15] grid_3.4.3 gtable_0.2.0 lazyeval_0.2.1 assertthat_0.2.0 tibble_1.4.1 Matrix_1.2-12 gridExtra_2.3
[22] ggplot2_2.2.1 glue_1.2.0 stringi_1.1.6 compiler_3.4.3 pillar_1.1.0 scales_0.5.0 zoo_1.8-1
[29] pkgconfig_2.0.1

goranbrostrom commented 6 years ago

Dear Jonathan,

if you have upgraded eha, after upgrading R to 3.4.3, and set the flag 'checkBuilt=TRUE' at the eha upgrade, and it still doesn't work, I'm lost. Maybe you could ask at R-help?

Regarding the other issue, 'plot' is a generic function and 'plot.weibreg' is an instance, and it is not exported, i.e., invisible to the user: Just use 'plot'. (You can use 'eha:::plot.weibreg' to call it directly, but it is not recommended.)

Hope this helps,

Best, Göran

goranbrostrom commented 6 years ago

One second thought: Is it possible that you have two instances of eha installed?

ghost commented 6 years ago

Göran,

Thanks again for bothering about this. It seems the fault must lie with me or my set-up.

Thanks for the advice about ‘plot.weibreg’ too. Best regards,

Jonathan

From: Göran Broström [mailto:notifications@github.com] Sent: 19 January 2018 22:42 To: goranbrostrom/eha eha@noreply.github.com Cc: Jonathan Reynolds jreynolds@gwct.org.uk; Author author@noreply.github.com Subject: Re: [goranbrostrom/eha] Error: weibsup not available / phsup no available (#1)

Dear Jonathan,

if you have upgraded eha, after upgrading R to 3.4.3, and set the flag 'checkBuilt=TRUE' at the eha upgrade, and it still doesn't work, I'm lost. Maybe you could ask at R-help?

Regarding the other issue, 'plot' is a generic function and 'plot.weibreg' is an instance, and it is not exported, i.e., invisible to the user: Just use 'plot'. (You can use 'eha:::plot.weibreg' to call it directly, but it is not recommended.)

Hope this helps,

Best, Göran

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/goranbrostrom/eha/issues/1#issuecomment-359110171, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJyUa2yoTDpUZEv4ckpP7JbfUkbNpMmcks5tMRpMgaJpZM4RkUb9.


[The Game & Wildlife Conservation Trust is accredited by Investors In People]

This communication from the Game & Wildlife Conservation Trust contains information which is confidential and may also be privileged. It is for the exclusive use of the addressee. If you are not the addressee please note that any distribution, copying or use of this communication or the information in it is prohibited. If you have received this communication in error, please telephone us immediately to arrange for its return.

The Game & Wildlife Conservation Trust is a charitable company limited by guarantee registered in England and Wales under number 05579632, registered charity number 1112023 (England and Wales) and SC038868 (Scotland). VAT Reg 665 2959 92. Registered Office: Burgate Manor, Fordingbridge, Hampshire SP6 1EF Tel: +44(0)1425 652381. Email: info@gwct.org.uk Web: www.gwct.org.uk Registered Office: Burgate Manor, Fordingbridge, Hampshire SP6 1EF Game & Wildlife Conservation Trading is a company limited by guarantee (registered no 1503620, VAT Reg No 323 7013 94.) which carries out trading and advisory activities and some fundraising events for the Game & Wildlife Conservation Trust.

Registered in England and Wales. Registered Office: Burgate Manor, Fordingbridge, Hampshire SP6 1EF

ghost commented 6 years ago

Göran, To complete the story for your peace of mind, I managed to get everything to run perfectly by moving the user personal library (ie the exact same files, not freshly installed) to my Desktop, and changing the R_LIBS_USER environmental variable in Control Panel to point to the new location. I don't really understand why this worked, but it seems the problem was somehow related to access rights, which our IT people have monkeyed with recently. What puzzles me most is why the eha library appeared to load, but failed to work. Thanks again for your time - and of course for a very valuable library. Jonathan

From: Göran Broström [mailto:notifications@github.com] Sent: 19 January 2018 22:44 To: goranbrostrom/eha eha@noreply.github.com Cc: Jonathan Reynolds jreynolds@gwct.org.uk; Author author@noreply.github.com Subject: Re: [goranbrostrom/eha] Error: weibsup not available / phsup no available (#1)

One second thought: Is it possible that you have two instances of eha installed?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/goranbrostrom/eha/issues/1#issuecomment-359110508, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJyUa1V424ZvatOmXKcNGxsq0Q01D3TWks5tMRq2gaJpZM4RkUb9.


[The Game & Wildlife Conservation Trust is accredited by Investors In People]

This communication from the Game & Wildlife Conservation Trust contains information which is confidential and may also be privileged. It is for the exclusive use of the addressee. If you are not the addressee please note that any distribution, copying or use of this communication or the information in it is prohibited. If you have received this communication in error, please telephone us immediately to arrange for its return.

The Game & Wildlife Conservation Trust is a charitable company limited by guarantee registered in England and Wales under number 05579632, registered charity number 1112023 (England and Wales) and SC038868 (Scotland). VAT Reg 665 2959 92. Registered Office: Burgate Manor, Fordingbridge, Hampshire SP6 1EF Tel: +44(0)1425 652381. Email: info@gwct.org.uk Web: www.gwct.org.uk Registered Office: Burgate Manor, Fordingbridge, Hampshire SP6 1EF Game & Wildlife Conservation Trading is a company limited by guarantee (registered no 1503620, VAT Reg No 323 7013 94.) which carries out trading and advisory activities and some fundraising events for the Game & Wildlife Conservation Trust.

Registered in England and Wales. Registered Office: Burgate Manor, Fordingbridge, Hampshire SP6 1EF

ghost commented 6 years ago

Göran, To complete the story for your peace of mind, I managed to get everything to run perfectly by moving the user personal library (ie the same files, not freshly installed) to my Desktop, and changing the R_LIBS_USER environmental variable in Control Panel to point to the new location. I don't fully understand why this worked, but it seems the problem was somehow related to access rights, which our IT people have monkeyed with recently. What puzzles me most is why the eha library appeared to load, but failed to work. Thanks again for your time - and of course for a very valuable library. Jonathan

From: Jonathan Reynolds Sent: Saturday, January 20, 3:18 PM Subject: RE: [goranbrostrom/eha] Error: weibsup not available / phsup no available (#1) To: goranbrostrom/eha

Göran,

Thanks again for bothering about this. It seems the fault must lie with me or my set-up.

Thanks for the advice about 'plot.weibreg' too. Best regards,

Jonathan

From: Göran Broström [mailto:notifications@github.com] Sent: 19 January 2018 22:42 To: goranbrostrom/eha eha@noreply.github.com Cc: Jonathan Reynolds jreynolds@gwct.org.uk; Author author@noreply.github.com Subject: Re: [goranbrostrom/eha] Error: weibsup not available / phsup no available (#1)

Dear Jonathan, if you have upgraded eha, after upgrading R to 3.4.3, and set the flag 'checkBuilt=TRUE' at the eha upgrade, and it still doesn't work, I'm lost. Maybe you could ask at R-help? Regarding the other issue, 'plot' is a generic function and 'plot.weibreg' is an instance, and it is not exported, i.e., invisible to the user: Just use 'plot'. (You can use 'eha:::plot.weibreg' to call it directly, but it is not recommended.) Hope this helps, Best, Göran

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/goranbrostrom/eha/issues/1#issuecomment-359110171, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJyUa2yoTDpUZEv4ckpP7JbfUkbNpMmcks5tMRpMgaJpZM4RkUb9.


[The Game & Wildlife Conservation Trust is accredited by Investors In People]

This communication from the Game & Wildlife Conservation Trust contains information which is confidential and may also be privileged. It is for the exclusive use of the addressee. If you are not the addressee please note that any distribution, copying or use of this communication or the information in it is prohibited. If you have received this communication in error, please telephone us immediately to arrange for its return.

The Game & Wildlife Conservation Trust is a charitable company limited by guarantee registered in England and Wales under number 05579632, registered charity number 1112023 (England and Wales) and SC038868 (Scotland). VAT Reg 665 2959 92. Registered Office: Burgate Manor, Fordingbridge, Hampshire SP6 1EF Tel: +44(0)1425 652381. Email: info@gwct.org.uk Web: www.gwct.org.uk Registered Office: Burgate Manor, Fordingbridge, Hampshire SP6 1EF Game & Wildlife Conservation Trading is a company limited by guarantee (registered no 1503620, VAT Reg No 323 7013 94.) which carries out trading and advisory activities and some fundraising events for the Game & Wildlife Conservation Trust.

Registered in England and Wales. Registered Office: Burgate Manor, Fordingbridge, Hampshire SP6 1EF