yjlee168
★★★
avatar
Homepage
Kaohsiung, Taiwan,
2015-12-19 21:47
(3021 d 13:05 ago)

(edited by yjlee168 on 2015-12-20 06:52)
Posting: # 15748
Views: 9,469
 

 Please do not upgrade ggplot2 to v2.0.0 if using bear [🇷 for BE/BA]

Dear all,

I just upgraded an R package ggplot2 to v2.0.0 and then found warming messages after loading bear (after typing library(bear) under R console):

Warning messages:
1: replacing previous import by‘grid::arrow’ when loading‘bear’
2: replacing previous import by‘grid::unit’ when loading‘bear’


However, it seems OK to run bear. Still it's quite annoying. So if you don't want to see these warning messages, please do the following:
  • Do not upgrade ggplot2 to v2.0.0; the current version is v1.0.1; If you have already upgraded, it can be downgraded back to v1.0.1 (that's what I did); or
  • If you really have to upgrade ggplot2 to v2.0.0, just ignore the warning messages; should be fine to run bear.
Ps. don't know why upgrading ggplot2 affects the other package, grid. [edited after OP]

All the best,
-- Yung-jin Lee
bear v2.9.1:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
d_labes
★★★

Berlin, Germany,
2015-12-21 10:29
(3020 d 00:22 ago)

@ yjlee168
Posting: # 15755
Views: 8,339
 

 Please do not upgrade ggplot2 to v2.0.0 if using bear

Dear Yung-jin,

IMHO its not a good idea to recommend your users not to update packages :no: they use eventually for other purposes than bear.

Instead you should figure out what's going on and what are the side effects, eventually harmful for bear users outside bear.

See here for a similar casus which may eventually help.

Regards,

Detlew
yjlee168
★★★
avatar
Homepage
Kaohsiung, Taiwan,
2015-12-21 12:41
(3019 d 22:10 ago)

@ d_labes
Posting: # 15756
Views: 8,286
 

 there is nothing I can do with bear...

Dear Detlew,

❝ IMHO its not a good idea to recommend your users not to update packages :no: they use eventually for other purposes than bear.


Indeed. It's really not a good idea. But there is nothing I can do so far. Either grid or ggplot2 need to be changed. The package grid has been included in R base (core). So we probably need to wait ggplot2 to be changed. However, the problem could be grid. In that case, we need to wait until next R release.

❝ Instead you should figure out what's going on and what are the side effects, eventually harmful for bear users outside bear.


Except with annoying warming messages, I still cannot find anything wrong. I have tested with demo dataset on platforms of Windows (Win7), linux-pc and Mac OSX. All seemed fine.

❝ See here for a similar casus which may eventually help.


Thank you so much. But the solution for the above pointer is to wait other package glmnet to be changed. Some similar situations have been reported, such as here, here & here. :ponder:

All the best,
-- Yung-jin Lee
bear v2.9.1:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
d_labes
★★★

Berlin, Germany,
2015-12-21 14:17
(3019 d 20:35 ago)

@ yjlee168
Posting: # 15757
Views: 8,213
 

 There is eventually something you can do with bear

Dear Yung-jin,

if I understood the matter correctly the issue arises since both grid and ggplot2 export functions with name arrow() and unit().

If you don't import the whole packages into the NAMESPACE for bear via the import(pckg1, pckg2, ...) directive but use instead importFrom(fun, pckg) for every function fun You really need from the package pckg there should no longer any conflict and the warnings should be gone.

May help, or may not since in the NAMESPACE of ggplot2 there is an import(grid) directive. If this is the source of the warnings you may contact the maintainer of ggplot2 w.r.t. this.
But library(ggplot2) doesn't issue any warnings. Thus there are good chances that my above advice could help.

Hope this was understandable and helps.

Regards,

Detlew
yjlee168
★★★
avatar
Homepage
Kaohsiung, Taiwan,
2015-12-21 21:56
(3019 d 12:55 ago)

(edited by yjlee168 on 2015-12-21 23:04)
@ d_labes
Posting: # 15758
Views: 8,250
 

 Detlew is always right... Ya~

Dear Detlew,

❝ If you don't import the whole packages into the NAMESPACE for bear via the import(pckg1, pckg2, ...) directive but use instead importFrom(fun, pckg)...


Tried as suggested. Not working after adding importFrom("grid",unit,arrow,grid.raster) or importFrom("ggplot2",ggplot) in the file NAMESPACE. Since package grid has been included in R base (core), I removed grid from package list of Imports: in the file DESCRIPTION and also removed grid from import() in the file of NAMESPACE. I guess that should work. It is not. The original warning messages disappeared but new error message comes out as "cannot find function: grid.raster." Finally, I used :: to solve this with code of grid::grid.raster(). Then, it works.:-D I have tried grid::grid.raster() on Sunday without deleting grid from package list of Imports: in the file DESCRIPTION and deleting grid from import() in the file of NAMESPACE. Thus, it did not work at that moment.

❝ Hope this was understandable and helps.


Yes, it really helps a lot. Thank you so much. :ok: bear v2.7.2 is on its way to sourceforge tonight. [edited. --> (1) have been uploaded, and (2) only work with ggplot2 v2.0.0.]

All the best,
-- Yung-jin Lee
bear v2.9.1:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
d_labes
★★★

Berlin, Germany,
2015-12-22 09:52
(3019 d 01:00 ago)

@ yjlee168
Posting: # 15759
Views: 8,224
 

 NAMESPACE blues

Dear Yung-jin,

not quite sure if I understand your solution. But the main point is that it works :cool:.

The whole mess comes IMHO from a hard to understand concept of NAMESPACE issues. At least for me it's hard to understand why to hell a function is imported from grid into ggplot2 which in turn is re-exported :confused:. See ?ggplot2::arrow f.i.
Seems only geniuses like Hadley understand this.

Regards,

Detlew
yjlee168
★★★
avatar
Homepage
Kaohsiung, Taiwan,
2015-12-22 12:22
(3018 d 22:30 ago)

@ d_labes
Posting: # 15760
Views: 8,178
 

 R is very blue sometimes

Dear Detlew,

❝ The whole mess comes IMHO from a hard to understand concept of NAMESPACE issues. At least for me it's hard to understand why to hell a function is imported from grid into ggplot2 which in turn is re-exported :confused:. See ?ggplot2::arrow f.i.


Very agree. me either. Have you seen this before about NAMESPACE in R?

BTW, if what I am doing is correct for bear (at least no warning messages and running is normal), should it be compatible with ggplot2 v1.0.1? But it is not. The error messages are Error in rasterGrob(image, x = x, y = y, width = width, height = height, : could not find function "unit". This error can be solved with importFrom("grid",unit,grid.raster) in the file of NAMESPACE. However, when this NAMESPACE file working with ggplot2 v2.0.0, the warning messages come back again. :confused: So I guess there are still something that I miss. I will try something else later.

❝ Seems only geniuses like Hadley understand this.


Hmm... I wonder.

All the best,
-- Yung-jin Lee
bear v2.9.1:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
d_labes
★★★

Berlin, Germany,
2015-12-22 14:06
(3018 d 20:45 ago)

@ yjlee168
Posting: # 15761
Views: 8,135
 

 R is very blue sometimes

Dear Yung-jin,

❝ ... Have you seen this before about NAMESPACE in R?


Seen: yes. Understood: no.

❝ BTW, if what I am doing is correct for bear (at least no warning messages and running is normal), should it be compatible with ggplot2 v1.0.1? But it is not. The error messages are Error in rasterGrob(image, x = x, y = y, width = width, height = height, : could not find function "unit". This error can be solved with importFrom("grid",unit,grid.raster) in the file of NAMESPACE. However, when this NAMESPACE file working with ggplot2 v2.0.0, the warning messages come back again. :confused: So I guess there are still something that I miss. I will try something else later.


Strange. But I think it depends on the NAMESPACE of both versions. I bet these are different.

Regards,

Detlew
yjlee168
★★★
avatar
Homepage
Kaohsiung, Taiwan,
2015-12-22 15:56
(3018 d 18:55 ago)

@ d_labes
Posting: # 15762
Views: 8,190
 

 ggplot2, grid and bear

Dear Detlew,

❝ Seen: yes. Understood: no.


I don't quite understand either. but seems interesting.

❝ Strange. But I think it depends on the NAMESPACE of both versions. I bet these are different.


I think I have done it. This time I use importFrom("ggplot2",...), not importFrom("grid",...) (because it won't work with ggplot2 v2.0.0 but v1.0.1). Yesterday I did importFrom("ggplot2",...) with no luck. That was because I still kept ggplot2 in the package list Imports in DESCRIPTION. I just remove ggplot2 from the package list of Imports in DESCRIPTION, as well as from the list of import(...) in the file of NAMESPACE. That means, when we use importFrom("foo",...), then the package foo cannot be in the package list of Imports in the file of DESCRIPTION, and also cannot be in the list of import(...) in the file of NAMESPACE. As you said yesterday, we just imported some functions (not the whole package). Therefore, this package cannot appear in the package list of Imports again. That's the key point. In this case, I put grid back to package list of "Imports" in DESCRIPTION, and also in import(...) of NAMESPACE.

I just tried importFrom("grid",...) again. And remove grid from the package list of Imports in DESCRIPTION. It works well too. So we have two importFrom() in NAMESPACE. I feel more comfortable now. This should make bear to work with ggplot2 either v2.0.0 or v1.0.1 [edited].

All the best,
-- Yung-jin Lee
bear v2.9.1:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
d_labes
★★★

Berlin, Germany,
2015-12-22 16:31
(3018 d 18:21 ago)

@ yjlee168
Posting: # 15763
Views: 8,111
 

 To Imports: or not to Imports:

Dear Yung-jin,

regarding the Imports: field in the description file I think you err. AFAIK this has the purpose to tell R while installing your package to also install all packages listed under this field. See genius Hadley.

Thus the keypoint seems not to use imports() and importsFrom() in the NAMESPACE. Either or! Best practice is always only importsFrom(). See https://cran.r-project.org/doc/manuals/r-release/R-exts.html, Chapter 1.5.1 "Specifying imports and exports".

If you need really hard stuff :-D read this.

But I think this thread goes too technically. Beside us only very few people will have interest.
Thus let's end here. Congratulation that the issue for bear is resolved. Why ever :cool:.

Count up: 991

Regards,

Detlew
UA Flag
Activity
 Admin contact
22,957 posts in 4,819 threads, 1,639 registered users;
84 visitors (0 registered, 84 guests [including 6 identified bots]).
Forum time: 10:52 CET (Europe/Vienna)

Nothing shows a lack of mathematical education more
than an overly precise calculation.    Carl Friedrich Gauß

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5