[R] problem for strsplit function

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Thu Jul 8 05:02:48 CEST 2021


sub( "\\.[^.]*$", "", fname )

On July 7, 2021 6:27:48 PM PDT, Kai Yang via R-help <r-help using r-project.org> wrote:
> Hello List,
>I have a  one column data frame to store file name with extension. I
>want to create new column to keep file name only without extension.
>I tried to use strsplit("name1.csv", "\\.")[[1]] to do that, but it
>just retain the first row only and it is a vector.  how can do this for
>all of rows and put it into a new column?
>thank you,
>Kai
>
>
>
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list