[R] adding a column to data frame solving the replacement problem

hoda rahmati hodarahmati68 at yahoo.com
Wed Feb 24 15:38:59 CET 2016

Hi all, 

I have a data set (mydata) containing 471 variables. One of the columns looks as below 

$ Sequence : Factor w/ 3 levels "","%Seq%gre",..: 2 2 2 2 2 2 2 2 2 2 ... 

sequence contains %Seq%gre and %Seq%tse and I extract only %Seq%tse and add it to my variables and plot a scatterplot of mydata. I use table and the result is: table(mydata$Sequence) 
 %Seq%gre %Seq%tse 
          1           25520          243744 
in the next step I  want to add a column to my main data set (mydata) containing only %Seq%tse, however when I use the following command there's an error telling me: 
Error in `$<-.data.frame`(`*tmp*`, "NewColumn", value = c(3L, 3L, 3L,  : 
  replacement has 243744 rows, data has 269265 
How can I add this column correctly to mydata? 
Thanks for any help
	[[alternative HTML version deleted]]

More information about the R-help mailing list