On R, I have several files ending with _tcount.tsv which is output from genomics analysis. I am following a written procedure. Running below script to read in the files.
```
ls = list.files(pattern = "_tcount.tsv")
df = do.call(cbind, Map("cbind", lapply(ls, read.delim, skip=2,header=T),sample=gsub("//..*","",ls)))
```
Problem is from next step when I try to reshape the 'df' using select() it complains that "Can't bind data because some arguments have the same nameTraceback:"
When I look at summary(df) I get a summary output of each file as separate summary. dim(df) only show dimension of only one file worth not the entire one. Next code
dfsprd <- df %>% select(sample, Name, CoverageOnTs, ConversionOnTs) %>%
gather(variable, value, CoverageOnTs, ConversionOnTs) %>%
unite(var, variable, sample) %>%
group_by(var) %>% mutate (id=1:n()) %>%
spread(var, value)
Example code I need to process is as above but I get an error as above on the first select() commend. What am I missing?
Found my mistake on the code.
It should have been rbind
instead of cbind
and thus the error message.
Thanks everyone for their responses.