Bug 362825 - Error in { : task 1 failed - "could not find function "trellis.last.object""
Summary: Error in { : task 1 failed - "could not find function "trellis.last.object""
Status: RESOLVED FIXED
Alias: None
Product: rkward
Classification: Applications
Component: User Interface (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: RKWard Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-08 19:27 UTC by Michael
Modified: 2017-06-04 19:02 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael 2016-05-08 19:27:07 UTC
This error only occurs when running the R code in RKWard. 
I ran the code in native R and the code runs as expected. 
I reinstalled lattice but it was no help.

The code is at this location.
https://github.com/hd625b/CaliforniaEarthQuakeStudy.git

RKWard
Version 0.6.4
Using KDE Development Platform 4.14.16

R version 3.2.5 (2016-04-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8          LC_NUMERIC=C                 
 [3] LC_TIME=en_US.UTF-8           LC_COLLATE=en_US.UTF-8       
 [5] LC_MONETARY=en_US.UTF-8       LC_MESSAGES=en_US.UTF-8      
 [7] LC_PAPER=en_US.UTF-8          LC_NAME=en_US.UTF-8          
 [9] LC_ADDRESS=en_US.UTF-8        LC_TELEPHONE=en_US.UTF-8     
[11] LC_MEASUREMENT=en_US.UTF-8    LC_IDENTIFICATION=en_US.UTF-8

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

other attached packages:
 [1] doMC_1.3.4           iterators_1.0.8      foreach_1.4.3       
 [4] effects_3.1-1        dplyr_0.4.3          plyr_1.8.3          
 [7] scatterplot3d_0.3-36 plot3D_1.1           reshape2_1.4.1      
[10] ggmap_2.6.1          ggplot2_2.1.0        rgl_0.95.1441       
[13] qcc_2.6              forecast_7.1         timeDate_3012.100   
[16] zoo_1.7-13           rkward_0.6.3        

loaded via a namespace (and not attached):
 [1] splines_3.2.5       lattice_0.20-33     colorspace_1.2-6   
 [4] XML_3.98-1.4        nloptr_1.0.4        sm_2.2-5.4         
 [7] DBI_0.4             sp_1.2-3            jpeg_0.1-8         
[10] stringr_1.0.0       munsell_0.4.3       gtable_0.2.0       
[13] RgoogleMaps_1.2.0.7 mapproj_1.2-4       codetools_0.2-14   
[16] labeling_0.3        misc3d_0.8-4        tseries_0.10-35    
[19] proto_0.3-10        Rcpp_0.12.4         geosphere_1.5-1    
[22] scales_0.4.0        lme4_1.1-12         fracdiff_1.4-2     
[25] digest_0.6.9        rjson_0.2.15        png_0.1-7          
[28] stringi_1.0-1       RJSONIO_1.3-0       grid_3.2.5         
[31] quadprog_1.5-5      tools_3.2.5         magrittr_1.5       
[34] maps_3.1.0          lazyeval_0.1.10     Matrix_1.2-6       
[37] MASS_7.3-45         minqa_1.2.4         assertthat_0.1     
[40] R6_2.1.2            vioplot_0.2         compiler_3.2.5     
[43] nlme_3.1-127        nnet_7.3-12
Comment 1 Michael 2016-05-08 21:01:57 UTC
(In reply to Michael from comment #0)
> This error only occurs when running the R code in RKWard. 
> I ran the code in native R and the code runs as expected. 
> I reinstalled lattice but it was no help.
> 
> The code is at this location.
> https://github.com/hd625b/CaliforniaEarthQuakeStudy.git
> 
> RKWard
> Version 0.6.4
> Using KDE Development Platform 4.14.16
> 
> R version 3.2.5 (2016-04-14)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 16.04 LTS
> 
> locale:
>  [1] LC_CTYPE=en_US.UTF-8          LC_NUMERIC=C                 
>  [3] LC_TIME=en_US.UTF-8           LC_COLLATE=en_US.UTF-8       
>  [5] LC_MONETARY=en_US.UTF-8       LC_MESSAGES=en_US.UTF-8      
>  [7] LC_PAPER=en_US.UTF-8          LC_NAME=en_US.UTF-8          
>  [9] LC_ADDRESS=en_US.UTF-8        LC_TELEPHONE=en_US.UTF-8     
> [11] LC_MEASUREMENT=en_US.UTF-8    LC_IDENTIFICATION=en_US.UTF-8
> 
> attached base packages:
> [1] parallel  stats     graphics  grDevices utils     datasets  methods  
> [8] base     
> 
> other attached packages:
>  [1] doMC_1.3.4           iterators_1.0.8      foreach_1.4.3       
>  [4] effects_3.1-1        dplyr_0.4.3          plyr_1.8.3          
>  [7] scatterplot3d_0.3-36 plot3D_1.1           reshape2_1.4.1      
> [10] ggmap_2.6.1          ggplot2_2.1.0        rgl_0.95.1441       
> [13] qcc_2.6              forecast_7.1         timeDate_3012.100   
> [16] zoo_1.7-13           rkward_0.6.3        
> 
> loaded via a namespace (and not attached):
>  [1] splines_3.2.5       lattice_0.20-33     colorspace_1.2-6   
>  [4] XML_3.98-1.4        nloptr_1.0.4        sm_2.2-5.4         
>  [7] DBI_0.4             sp_1.2-3            jpeg_0.1-8         
> [10] stringr_1.0.0       munsell_0.4.3       gtable_0.2.0       
> [13] RgoogleMaps_1.2.0.7 mapproj_1.2-4       codetools_0.2-14   
> [16] labeling_0.3        misc3d_0.8-4        tseries_0.10-35    
> [19] proto_0.3-10        Rcpp_0.12.4         geosphere_1.5-1    
> [22] scales_0.4.0        lme4_1.1-12         fracdiff_1.4-2     
> [25] digest_0.6.9        rjson_0.2.15        png_0.1-7          
> [28] stringi_1.0-1       RJSONIO_1.3-0       grid_3.2.5         
> [31] quadprog_1.5-5      tools_3.2.5         magrittr_1.5       
> [34] maps_3.1.0          lazyeval_0.1.10     Matrix_1.2-6       
> [37] MASS_7.3-45         minqa_1.2.4         assertthat_0.1     
> [40] R6_2.1.2            vioplot_0.2         compiler_3.2.5     
> [43] nlme_3.1-127        nnet_7.3-12

The error occurs when the "effect' function runs.
# Effects Plot ===== 
  print(plot(effect("net:magType",
    netBymagType),
    main = paste("Effect Plot - net by magType\n", Sys.Date()),
    lwd = 2,
    cex = 1.1,
    color = "black",
    ylab = "Maginitude",
    xlab = paste("'net' = Source of the Information \n",
      "magType = The Method used to Calculate the Magnitude")))

Error in rk.record.plot$.save.tlo.in.hP() : 
  could not find function "trellis.last.object"
Comment 2 Thomas Friedrichsmeier 2016-05-09 07:46:25 UTC
Thanks for reporting. I'll try to look into this, soon, but very distracted, ATM.

Could you add the output of
    getAnywhere ("trellis.last.object")
to this report (after the error)?

For the time being, you should be able to work around this by disabling the plot history feature, either for this call, only (rk.without.plot.history()) or entirely (Settings->Onscreen Graphics->Screen device history).
Comment 3 Michael 2016-05-09 13:36:05 UTC
Error in { :
   task 1 failed - "could not find function "trellis.last.object""
 > getAnywhere("trellis.last.object")
A single object matching ‘trellis.last.object’ was found
It was found in the following places
   namespace:lattice
with value

function (..., prefix = lattice.getStatus("current.prefix"))
{
     if (!lattice.getStatus("current.plot.saved", prefix = prefix)) {
         warning("Requested 'trellis' object was not saved")
         return(invisible(NULL))
     }
     ans <- lattice.getStatus("last.object", prefix = prefix)
     update(ans, ...)
}
<environment: namespace:lattice>

Thank You.


On 05/09/2016 12:46 AM, Thomas Friedrichsmeier via KDE Bugzilla wrote:
> https://bugs.kde.org/show_bug.cgi?id=362825
>
> Thomas Friedrichsmeier <thomas.friedrichsmeier@ruhr-uni-bochum.de> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |thomas.friedrichsmeier@ruhr
>                     |                            |-uni-bochum.de
>
> --- Comment #2 from Thomas Friedrichsmeier <thomas.friedrichsmeier@ruhr-uni-bochum.de> ---
> Thanks for reporting. I'll try to look into this, soon, but very distracted,
> ATM.
>
> Could you add the output of
>      getAnywhere ("trellis.last.object")
> to this report (after the error)?
>
> For the time being, you should be able to work around this by disabling the
> plot history feature, either for this call, only (rk.without.plot.history()) or
> entirely (Settings->Onscreen Graphics->Screen device history).
>
Comment 4 Thomas Friedrichsmeier 2017-06-04 12:36:31 UTC
Hi!

Sorry for the long delay. I'm having trouble running your example, but I think I have an idea what's going wrong.

Can you confirm that the problem goes away, if you properly attach the lattice package (instead of just loading the namespace):
  library(lattice)

?

In a separate session, can you confirm that running the following fixes the issue?

assign (".save.tlo.in.hP", function (devId = dev.cur()) 
{
    if (!.is.device.managed(devId)) 
        return(invisible())
    devId <- as.character(devId)
    histPositions[[devId]]$plot <<- lattice:::trellis.last.object()
    histPositions[[devId]]$tlo.ls <<- get("lattice.status", envir = lattice:::.LatticeEnv)
    invisible()
}, envir=rk.record.plot
)

Regards
Thomas
Comment 5 Thomas Friedrichsmeier 2017-06-04 19:02:15 UTC
Git commit 09e4e14c41439d9297d2d02708dab7f106bdb97c by Thomas Friedrichsmeier.
Committed on 04/06/2017 at 19:00.
Pushed by tfry into branch 'frameworks'.

Fix breakage with trellis plots, when lattice is imported as a namespace, only, not on the search path.

M  +1    -0    ChangeLog
M  +1    -1    rkward/rbackend/rpackages/rkward/R/public_graphics.R

https://commits.kde.org/rkward/09e4e14c41439d9297d2d02708dab7f106bdb97c