Using R, what do I need to do to split col4 of TABLEA below into col4a and col4b of TABLEB below? I can't figure out how to get this to work, when there might not always be a 3rd "-" to split on. Thanks!
TABLEA: |col1|col2|col3|col4| |----|----|----|----| |data|data|data|hippo-11-trx-2021| |data|data|data|goose-17-plt-2017| |data|data|data|monkey-01-mno| |data|data|data|zebra-99-451-2019|
TABLEB: |col1|col2|col3|col4a|col4b| |----|----|----|----|----| |data|data|data|hippo-11-trx|2021| |data|data|data|goose-17-plt|2017| |data|data|data|monkey-01-mno|NA| |data|data|data|zebra-99-451|2019|
https://stackoverflow.com/questions/65964242/r-separate-a-column-into-two-columns-based-on-nth-occurrence-of-delimiter January 30, 2021 at 11:04AM
没有评论:
发表评论