Error in adding data in columns of R data frame This is my file

df1 = read.csv("HSC_LSC_BLAST_karyotyope.txt",header = TRUE,sep = ",",row.names = 1)

metadata &lt;- data.frame(row.names = colnames(df1))
metadata$Group &lt;- rep(NA, ncol(df1))
metadata$Group[seq(1,4,1)] &lt;- 'HSC'
metadata$Group[seq(5,15,1)] &lt;- 'Blast'
metadata$Group[seq(16,23,1)] &lt;- 'LSC'
#metadata$Group[seq(13,16,1)] &lt;- 'Mono'
metadata$Cytogenetics[seq(1,4,1)] &lt;- 'Healthy'
metadata$Cytogenetics[seq(5,21,1)] &lt;- 'NK'
metadata$Cytogenetics[seq(22,23,1)] &lt;- 'Abnormal'



&gt;s metadata$Cytogenetics[seq(1,4,1)] &lt;- 'Healthy' Error in `$&lt;-.data.frame`(`*tmp*`, Cytogenetics, value = c("Healthy",  :   
&gt; replacement has 4 rows, data has 23



Im trying to add other metadata information based on clinical information apart from giving sample labeling , im certainly doing something wrong but im not sure what it is. As my idea is the another column named Cytogenetics which would have respective information status but im getting that error.
Add the Cytogenetics columns and then assign things to a subset of it.

metadata &lt;- data.frame(row.names = colnames(df1))
metadata$Group &lt;- NA     # you don't need to write a vector; just NA does the job
metadata$Group[seq(1,4,1)] &lt;- 'HSC'
metadata$Group[seq(5,15,1)] &lt;- 'Blast'
metadata$Group[seq(16,23,1)] &lt;- 'LSC'
metadata$Cytogenetics &lt;- NA    # initiate the column with NA values
metadata$Cytogenetics[seq(1,4,1)] &lt;- 'Healthy'
metadata$Cytogenetics[seq(5,21,1)] &lt;- 'NK'
metadata$Cytogenetics[seq(22,23,1)] &lt;- 'Abnormal'