Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
> name = '645te5.78d'
我正在寻找一个可以摆脱我的变量中的点和任何内容的函数name。
name
> new_fun(name) > name '645te5'
sub should work:
sub
sub('\\..*', '', name)
If that is a general case that
There exist only one dot and you want to get the first part. Maybe you strsplit instead.
strsplit
unlist(strsplit(name, '\\.'))[1]