[問題] 正則表達式-"\\."
[軟體熟悉度]:
魯肉腳
[問題敘述]:
coursera某篇在教strsplit的section:
>names(cameraData)
[1] "address" "direction" "street" "crossStreet" "intersection" "Location.1"
該篇教學內容主要目的是要透過strsplit將"Location.1"經由"."分離,因此要設正則
表達式:
splitNames = strsplit(names(cameraData), "\\.")
我不懂的地方在於,為何"\\"是兩個而不是一個,當我只用一個"\"的時候,會出現以下
警告:
>strsplit(names(cameraData), "\.")
錯誤: 在起始 ""\." 的字串中 '\.' 是無法辨識的跳脫字元
是否有好心大大可以解惑?謝謝
[關鍵字]:
regular expression
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 210.61.216.119
※ 文章網址: http://www.ptt.cc/bbs/R_Language/M.1418208280.A.A1D.html
→
12/10 18:54, , 1F
12/10 18:54, 1F
→
12/10 19:07, , 2F
12/10 19:07, 2F
→
12/12 23:33, , 3F
12/12 23:33, 3F
→
12/19 16:25, , 4F
12/19 16:25, 4F
→
12/19 16:26, , 5F
12/19 16:26, 5F
→
12/19 16:26, , 6F
12/19 16:26, 6F
→
12/19 19:07, , 7F
12/19 19:07, 7F
推
12/20 00:13, , 8F
12/20 00:13, 8F
→
12/20 00:14, , 9F
12/20 00:14, 9F
→
12/20 00:14, , 10F
12/20 00:14, 10F
推
12/20 00:22, , 11F
12/20 00:22, 11F
→
12/20 00:23, , 12F
12/20 00:23, 12F
→
12/20 00:24, , 13F
12/20 00:24, 13F
→
12/20 00:25, , 14F
12/20 00:25, 14F
→
12/20 00:26, , 15F
12/20 00:26, 15F
推
12/20 00:30, , 16F
12/20 00:30, 16F
→
12/29 21:37, , 17F
12/29 21:37, 17F
→
12/29 21:38, , 18F
12/29 21:38, 18F
→
12/29 21:39, , 19F
12/29 21:39, 19F
→
12/29 21:40, , 20F
12/29 21:40, 20F
R_Language 近期熱門文章
PTT數位生活區 即時熱門文章