Hello,
I have tested the following lines of codes in an R interactive session (linux box) successfully
library(EBImage)
library(dplyr)
i = readImage("tmp.png")
r = as.vector(channel(i, 'red'))
g = as.vector(channel(i, 'green'))
b = as.vector(channel(i, 'blue'))
. = rgb2hsv(r, g, b) %>% t %>% as.data.frame %>% mutate(dgci=(((h-0.1666667)/0.1666667) + (1-s) + (1-v))/3)
But when I use the code in my test.R script I get an error with Rscript:
Rscript test.R
Error in asub.default(x, i, 3) : could not find function "Quote"
Calls: channel -> selectChannel -> asub -> asub.default
Execution halted
The problem seems to be
channel(i, 'red')
Can someone explain, and give me an alternate solution to get this run?
Thanks
Kevin
Thanks Martin, I basically came to similar conclusions.
I was wondering what would be the best way of fixing this on our side. The problem seems to be related to the fact that methods package needs to be attached in order to manipulate S4 objects by abind, as running the following in Rscript also fails.
Adding
import("methods")
to abind's NAMESPACE seems to fix the issue. Should this be communicated to the maintainer? I think the only other way of fixing this for EBImage would be to addDepends: methods
to DESCRIPTION.Yes it seems like an upstream issue and the abind maintainer should fix it, rather than trying to come up with work-arounds down-stream.