yjlee168 ★★★ ![]() ![]() Kaohsiung, Taiwan, 2015-12-19 21:47 (3414 d 21:00 ago) (edited on 2015-12-20 06:52) Posting: # 15748 Views: 10,402 |
|
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: 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:
ggplot2 affects the other package, grid . [edited after OP]— All the best, -- Yung-jin Lee bear v2.9.2:- 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 (3413 d 08:17 ago) @ yjlee168 Posting: # 15755 Views: 9,056 |
|
Dear Yung-jin, IMHO its not a good idea to recommend your users not to update packages ![]() 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 ★★★ ![]() ![]() Kaohsiung, Taiwan, 2015-12-21 12:41 (3413 d 06:05 ago) @ d_labes Posting: # 15756 Views: 8,993 |
|
Dear Detlew, ❝ IMHO its not a good idea to recommend your users not to update packages 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 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. ![]() — All the best, -- Yung-jin Lee bear v2.9.2:- 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 (3413 d 04:30 ago) @ yjlee168 Posting: # 15757 Views: 8,919 |
|
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 ★★★ ![]() ![]() Kaohsiung, Taiwan, 2015-12-21 21:56 (3412 d 20:50 ago) (edited on 2015-12-21 23:04) @ d_labes Posting: # 15758 Views: 8,955 |
|
Dear Detlew, ❝ If you don't import the whole packages into the NAMESPACE for 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.![]() 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. ![]() ggplot2 v2.0.0.]— All the best, -- Yung-jin Lee bear v2.9.2:- 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 (3412 d 08:55 ago) @ yjlee168 Posting: # 15759 Views: 8,935 |
|
Dear Yung-jin, not quite sure if I understand your solution. But the main point is that it works ![]() 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 ![]() Seems only geniuses like Hadley understand this. — Regards, Detlew |
yjlee168 ★★★ ![]() ![]() Kaohsiung, Taiwan, 2015-12-22 12:22 (3412 d 06:25 ago) @ d_labes Posting: # 15760 Views: 8,907 |
|
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 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. ![]() ❝ Seems only geniuses like Hadley understand this. Hmm... I wonder. — All the best, -- Yung-jin Lee bear v2.9.2:- 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 (3412 d 04:40 ago) @ yjlee168 Posting: # 15761 Views: 8,851 |
|
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 Strange. But I think it depends on the NAMESPACE of both versions. I bet these are different. — Regards, Detlew |
yjlee168 ★★★ ![]() ![]() Kaohsiung, Taiwan, 2015-12-22 15:56 (3412 d 02:50 ago) @ d_labes Posting: # 15762 Views: 8,906 |
|
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. grid back to package list of "Imports" in DESCRIPTION, and also in import(...) of NAMESPACEI 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.2:- 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 (3412 d 02:16 ago) @ yjlee168 Posting: # 15763 Views: 8,821 |
|
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 ![]() 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 ![]() Count up: 991 — Regards, Detlew |