How to grep a specific integer in R? -


how grep specific integer in r ? thought parameter fixed=true allowed apparently not case:

namedatatable = "long_te_b.xpt" ndie = 1 datatable = read.xport(namedatatable) pos_datatable_die = grep(as.character(ndie), datatable[,"dieindex"], fixed=true) datatabledie = datatable[pos_datatable_die,] 

that takes lines dieindex equal 11. problem me :

> datatabledie[947, "dieindex"] 

[1] 1

> datatabledie[949, "dieindex"] 

[1] 11

how settle it, please ? thank in advance.

william

we can paste ^ , $ more specific. or use word boundary (\\b)

grep(paste0("^",ndie, "$"), datatable[,"dieindex"]) 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -