Tuesday, May 6, 2014

Adding column entries to DataFrame objects

The DataFrame class comes from the IRanges package and is used by several other packages (eg. Rsamtools) to read in bam files.

Simply cbind-ing a column to the DataFrame object will change it to the more conventional data.frame class.

So, instead of 
cbind(object1,newcolumn)

do:
cbind(object1,DataFrame(newcolumn))

to ensure that the result is still in the DataFrame class.

No comments:

Post a Comment