0

I am having a csv file like:

sno pos code
1 2323 abc
1 2324 
1 2346 lss
. .    .
. .    .
. .    .
1 9999 hys

I have one more file like

sno start end
1 2320 2330
1 2350 2360
1 3556 3566
.  .   .
.  .   .
.  .   .
1  9990 10000

I want to print alphabets between these positions.

Desired output

1  2320 2330 abc
.    .      .
.    .      .
1  3560 3570 hgj
.    .      .
.    .      .
.    .      .
1 9990 10000 hys

Is there any way I can do this? My programming is very weak and need help for the same.

Thanks

Arora
  • 29
  • 8
  • `fuzzyjoin::fuzzy_inner_join(df1, df2, by = c('sno', 'pos' = 'start', 'pos' = 'end'), match_fun = list(\`==\`, \`>=\`, \`<=\`))` from https://stackoverflow.com/questions/24480031/overlap-join-with-start-and-end-positions – Ronak Shah Aug 19 '20 at 02:39
  • Dear Ronak, I am defing df1<-read.csv("1.csv") and df2<-read.table("2.bed") and running the script. I am getting an error : All columns in a tibbles must be vectors. x col is NULL. I will be grateful to you for right direction – Arora Aug 19 '20 at 05:42
  • What is `class(df1)` and `class(df2)` ? Can you add `dput(head(df1))` and `dput(head(df2))` in your post? – Ronak Shah Aug 19 '20 at 05:46
  • class(df1 and df2) [1] "data.table" "data.frame".!!! dput(head(df1)) structure(list(V1 = "2.bed"), row.names = c(NA, -1L), class = c("data.table", "data.frame"), .internal.selfref = ) respectively – Arora Aug 19 '20 at 05:51

0 Answers0