regex - Remove everything after a string in a data frame column with missing values -


I have a data frame similar to the essence of the bottom:

  Overview Identifier Value Objects ABC_2001 54 I would like to convert this data frame into a data frame, where the part after the string  "_" . The signature will be removed: As illustrated below:  
  Overview Identifier_Not Time Value ABC 54 Objacs2 ABC-2 Obback 3 1 Obscene 1 Obscene 1 Def  
< P> I tried using strsplit , gsub and sub with discussion here but appreciated the work of those people I can not do this for the fact that:

  1. The values ​​in the column can not be c I want to leave them and where they are
  2. The string "_" is located in different places
  3. text ">

    You can try the sub command below to remove all non-space characters from the _ symbol.

      sub   
    • _ matches a literal _ symbol. / Li>
    • \ S * matches zero or more non-space characters.

    OR

    all of these characters Micro _ will remove the symbol,

      sub ( "_.  

    Explanation:

    • _ one word Matches _ symbol
    • . * matches any character with zero or more times.

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -