Posts

Showing posts with the label extraction

How to extract rows from my data frame without having a data format conversion?

How to extract rows from my data frame without having a data format conversion? I would like to extract rows from a big dataset, named data1. My destination is to add a new column next to the Value of the extracted data1. Before that, I need to extract some GeneSymbols and then I would like to make a new column in the extracted data frame. Let's hypothetically say if this is my data. GeneSymbol ID Value let-7 A 0.5 miR-16 A 0.7 miR-19 A 0.3 miR-21 A 0.2 add1 = 1 data11 = cbind(data1, add1) head(data11) GeneSymbol ID Value add1 let-7 A 0.5 1 miR-16 A 0.7 1 miR-19 A 0.3 1 miR-21 A 0.2 1 It works well if I do not extract rows from my data set. However, I am in trouble if I do like this. newdata1 = data1[c("let-7", "miR-19"),] head(newdata1) GeneSymbol ID Value <NA> <NA> NA <NA> <NA> NA Why my data became NAs? I got stuck. Since my real data is big, over 30,000 rows. Also, my target ...