I've extracted the specific value from dataframe successfully in R. However, there's another problem that I can't solve. If there's any help that would be appreciated.
the raw data looks like as below: I'd like to extract 6 digits numbers from every rows, but there's NA some rows in the frame. It looks like this:
df <- data.frame(
v1=c('aa',438652,22,01,54,5892),
v2=c(343012,45,'pi',75,2001,3),
v3=c(56,'hi',78,670934,77,90),
v4=c('cc','go',35,4458,40021,576),
v5=c('ya',435,05,44,90032,6021),
v6=c(432,21,3013,5,302001,'fgh'))
However,
I'd like to extract "6 digits numbers" out into another new frame and also included with "NA"
It's looked like this:
new <- data.frame(
v7=c(343012,438652,NA,670934,302001,NA))
Does anyone have any ideas? That would be a great appreciation !!