R language: Extract the file name string from the path (basename function)

Source: Internet
Author: User

Suppose there is a path c:/coverage/homo_sapiens.sort.add_exon1_coverage.txt, to extract Homo_sapiens.sort.add_exon1_ Coverage.txt the file name, use the BaseName function and the start, stop parameter, as shown in the command line:

filename<-' C:/coverage/homo_sapiens.sort.add_exon1_coverage.txt ' substr (basename (filename), start = 1, stop = 4) # Represents the first character of the extracted file name to the fourth character, which is homosubstr (basename (filename), start = total, stop = #表示提取文件名的第23个字符至第27个字符, or Exon1paste (substr ( basename (path), start = 1, stop = 4), substr (basename (path), start = all, stop =)) #将两个字符黏贴起来

The effect is as follows:

R language: Extract the file name string from the path (basename function)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.