Colour analysis

Hi there I'm performing a colour analysis on photographs in R studio and really struggling with the error I am getting. I am trying to convert "RGB to s single colour code value" using reshape2 and metl and getting various errors.

the code:

fr.kmeans.clusters
fr.kmeans.clusters.long <- reshape2::melt(fr.kmeans.clusters); names(fr.kmeans.clusters.long)[3] <- "photo.id";
fr.kmeans.clusters.long$id <- substr(fr.kmeans.clusters.long$photo.id,0,7); fr.kmeans.clusters.long
fr.kmeans.clusters.long$wing.colour.type <- rep(c( "black", "yellow","red"), length(listimages)); fr.kmeans.clusters.long

with the second line of code the error is: "No id variables; using all as measure variables"

3rd line: "No id variables; using all as measure variables"

4th line (after an output of 250 values): "[ reached 'max' / getOption("max.print") -- omitted 9750 rows ]"

4th line: "Error in $<-.data.frame(*tmp*, wing.colour.type, value = c("black", :
replacement has 1875 rows, data has 10000"

I have over 1400 photographs, What should I do to fix this? What exactly is causing the problem?

Welcome! I'm afraid you'll need to supply some more info in order for helpers to be able to understand your problem (this is pretty common — when you're new to this stuff, it's hard to know how much information is enough!).

The best thing would be if you can make your question into a reproducible example (follow the link for instructions and explanations). To include your data, you'll want to follow one of the methods discussed here.

If you try all that and get stuck, here's a fallback option...
  1. Edit your post and add in some of the code you have tried. It's OK it doesn't work! It's really helpful to see what you've been attempting. Be sure to format your code as code (it's hard to read unformatted code, and it can get garbled by the forum software)
  2. Include sample data:
    • If your data set is OK to share, run the following line and paste the output into your post. Again, be sure to format it as code :sparkles:
    dput(head(your_dataframe_name, 10))
    
    • If your data set can't be shared, run this line instead and paste the output into your post (and yes, format as code!) This will still share some information about your data. If it's truly confidential, I'm afraid you'll need to make a fake sample dataset to share.
    str(your_dataframe_name)
    

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.