找回密码
 立即注册
查看: 3089|回复: 2

急!请问如何把数据里的字母数字分开/去掉字母

[复制链接]
发表于 2016-6-7 12:15:54 | 显示全部楼层 |阅读模式
只要1,2,3~~~ 不要pick.
谢谢谢谢!!

[1] " 1st pick "   " 2nd pick "   " 4th pick "   " 5th pick "   " 6th pick "   " 7th pick "  
  [7] " 8th pick "   " 9th pick "   " 10th pick "  " 11th pick "  " 12th pick "  " 13th pick "
[13] " 14th pick "  " 15th pick "  " 16th pick "  " 17th pick "  " 18th pick "  " 19th pick "
[19] " 20th pick "  " 21st pick "  " 22nd pick "  " 23rd pick "  " 24th pick "  " 25th pick "
[25] " 26th pick "  " 27th pick "  " 28th pick "  " 29th pick "  " 30th pick "  " 31st pick "
[31] " 32nd pick "  " 33rd pick "  " 34th pick "  " 35th pick "  " 36th pick "  " 37th pick "
[37] " 38th pick "  " 39th pick "  " 40th pick "  " 41st pick "  " 42nd pick "  " 43rd pick "
[43] " 44th pick "  " 45th pick "  " 46th pick "  " 47th pick "  " 48th pick "  " 49th pick "
[49] " 50th pick "  " 51st pick "  " 52nd pick "  " 53rd pick "  " 54th pick "  " 55th pick "
[55] " 56th pick "

回复

使用道具 举报

发表于 2016-6-7 20:04:36 | 显示全部楼层
x <- c( " 1st pick " ,  " 2nd pick " ,  " 4th pick "  , " 5th pick " ,  " 6th pick " ,  " 7th pick "  )
y <- gsub("pick","",x)
回复

使用道具 举报

发表于 2016-6-21 23:18:09 | 显示全部楼层
楼上正解,对于这种文本出现一次的情况,也可以用y <- sub("pick","",x)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|R语言中文网

GMT+8, 2024-11-23 10:32 , Processed in 0.035628 second(s), 17 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表