Rstudio creating problem in color development

Hi,
I am facing the bellow error in Rstudio. however, the same code was working before my data normalization. Now after some data filtration and normalization, I used the same code but showing this issue please help me I am not that much efficient to understand the issue.

View(data)

library(ggplot2)
library(reshape2)
data$SuperPathway.id <- 1:nrow(data)
data_long <- reshape(data,

  •                  varying = colnames(data)[3:26],
    
  •                  v.names = "Abundance",
    
  •                  timevar = "target",
    
  •                  times = colnames(data)[3:26],
    
  •                  direction = "long")
    

mycols = c("#E41A1C", "#377EB8", "#4DAF4A", "#984EA3", "#FF7F00", "#cfa602")
mycols_yaxis <- rep(rep(mycols, c(4, 3, 4, 4, 11, 4)), 28)
data_long$colors <- mycols_yaxis
Error in $<-.data.frame(*tmp*, colors, value = c("#E41A1C", "#E41A1C", :
replacement has 840 rows, data has 600

Could you please turn this into a self-contained reprex (short for reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.

install.packages("reprex")

If you've never heard of a reprex before, you might want to start by reading the tidyverse.org help page. The reprex dos and don'ts are also useful.

There's also a nice FAQ on how to do a minimal reprex for beginners, below:

What to do if you run into clipboard problems

If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.

reprex::reprex(input = "fruits_stringdist.R", outfile = "fruits_stringdist.md")

For pointers specific to the community site, check out the reprex FAQ.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.