Hello Genius's!
I read some blog posts by various Alteryx and R artists on how to extract colors from an image. @BenMoss has an awesome one here that was extremely helpful, in fact I used his example more so than other ones.
I'm having trouble with an error in the example Ben has on his blog. I've installed the png R package correctly (I believe), but I keep getting the error below. I've also attached the workbook I'm working in as well as the picture I wanted to use as an example (hidden in the .yxzp file). You'll need to change the filepath to make it work.
THANK YOU!!!
Error in seq.default(0,1, length.out = nrow(z))

This is the code I'm using:
## Open libraries required to complete analysis
library("png")
library("grid")
library("gridExtra")
## Read image into R. This will return a large array of elements
## which contains the RGB values (seperately) for each individual
## pixal within the image
image = readPNG("FILE PATH PLACEHOLDER")
## Convert the large array into a data frame containing 3 columns
## one for each of the three RGB values
df = data.frame(
red = matrix(image(,,1), ncol=1),
green = matrix(image(,,1), ncol=1),
blue = matrix(image(,,1), ncol=1)
)
## Write our data frame for output
write.Alteryx(df, 1)