Flowchart using {diagram} in R 3.0.0 for Windows

I am trying to remake the flowchart in R using the diagram package (v 1.6). I was able to plot using this exact script (which I changed from the example in the diagram documentation), but as soon as I updated R to 3.0.0, the coordinate function will give me an error. Here is an example:

library(graphics)
library(diagram)

par(mar = c(1, 1, 1, 1))
openplotmat()
elpos<-coordinates(c(1,1,2,4))

Error in (function (classes, fdef, mtable)  : unable to find an inherited method for function ‘coordinates’ for signature ‘"numeric"

I'm still not familiar with R and code, etc., so when I run traceback (), I really don't understand what it is telling me:

3: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
   sQuote(fdef@generic), sQuote(cnames)), domain = NA)
2: (function (classes, fdef, mtable) 
  {
   methods <- .findInheritedMethods(classes, fdef, mtable)
   if (length(methods) == 1L) 
       return(methods[[1L]])
   else if (length(methods) == 0L) {
       cnames <- paste0("\"", sapply(classes, as.character), 
           "\"", collapse = ", ")
       stop(gettextf("unable to find an inherited method for function %s for signature %s", 
           sQuote(fdef@generic), sQuote(cnames)), domain = NA)
   }
   else stop("Internal error in finding inherited methods; didn't return a unique method", 
       domain = NA)
  })(list("numeric"), function (obj, ...) 
  standardGeneric("coordinates"), <environment>)
1: coordinates(c(1, 1, 2, 4))

Basically, I don’t know why the coordinates () will not work after the update. Any understanding of this, as well as possibly translating the trace will be a huge help. Thank!

+5
source share
1 answer

, . :

library(diagram)
openplotmat()
(elpos1 <- diagram::coordinates(c(1,1,2,4)))
#       [,1]  [,2]
# [1,] 0.500 0.875
# [2,] 0.500 0.625
# ...

coordinates -:

help.search('coordinates', fields='name')
# Help files with name matching 'coordinates' using fuzzy matching:
# 
# diagram::coordinates                  coordinates of elements on a plot
# sp::coordinates-methods               retrieve (or set) spatial coordinates
# sp::coordinates                       sets spatial coordinates to create spatial data, or retrieves spatial
#                                       coordinates
# sp::coordnames                        retrieve or assign coordinate names for classes in sp

( ) . , sp . .

(, )

, , . :

# ensure we have neither package loaded
detach(package:diagram, unload=TRUE) # ignore errors if not loaded
detach(package:sp, unload=TRUE)      # ignore errors if not loaded
library(diagram)
library(sp)
# Attaching package: 'sp'
# 
# The following object is masked from 'package:diagram':
# 
#     coordinates

, coordinates() sp, diagram. ( detach(), , , , Space .)

sp , , : diagram, sp:

library(diagram)
library(sp)
# Attaching package: 'sp'
# 
# The following object is masked from 'package:diagram':
# 
#     coordinates
(elpos <- coordinates(c(1,1,2,4)))
# Error in (function (classes, fdef, mtable)  : 
# unable to find an inherited method for function 'coordinates' for signature '"numeric"'

traceback() , .

:

library(sp)
library(diagram)
# Attaching package: 'diagram'
# 
# The following object is masked from 'package:sp':
# 
#     coordinates
(elpos <- coordinates(c(1,1,2,4)))
#       [,1]  [,2]
# [1,] 0.500 0.875
# [2,] 0.500 0.625
# ...

, , sp::coordinates() .

,

- , , :

(elpos <- diagram::coordinates(c(1,1,2,4)))
#       [,1]  [,2]
# [1,] 0.500 0.875
# [2,] 0.500 0.625
# ...

, , . , , traceback(). , .findInheritedMethods(), , diagram::coordinates , , 2- , "NULL", sp::coordinates , "" ( ).

+2