小编fra*_*eek的帖子

为什么这个正则表达式不适用于R

我已经尝试过grep,grepl,regexpr,gregexpr以及所有返回失败或非整数.

Ojbect是"test",它是一个带地址的字符串.示例提供:

[9972] "1350 Hwy 160 W\nFort Mill, SC 29715"                                                                 
[9973] "Sonoran Desert Dentistry\n9220 E Raintree Dr\nSte 102\nScottsdale, AZ 85260"                         
[9974] "3252 Vilas Rd\nCottage Grove, WI 53527"                                                              
[9975] "224 W Cottage Grove Rd\nCottage Grove, WI 53527"                                                     
[9976] "320 W Cottage Grove Rd\nCottage Grove, WI 53527"                                                     
[9977] "7914 State Road 19\nDane, WI 53529"                                                                  
[9978] "106 Dane St\nDane, WI 53529"
Run Code Online (Sandbox Code Playgroud)

目标是在最后一个"\n"之后提取所有内容,以便通过邮政编码保留城市.比如"Cottage Grove,WI 53527"

以下是grep和regex的示例:

> grep("\\[^\\]+$", test)
integer(0)
Run Code Online (Sandbox Code Playgroud)

任何帮助都会很棒.

regex r

3
推荐指数
1
解决办法
65
查看次数

每分钟安排一次Rscript crontab

出于某种原因,我的R脚本不会与crontab一起运行.我现在每分钟都有它进行测试,但一旦工作就会改变它.

有任何想法吗?

* * * * * Rscript “/Users/Home/Desktop/David Studios/Scraper/compiler.R”
Run Code Online (Sandbox Code Playgroud)

此外,这只是终端中的正常命令.

terminal cron r crontab

3
推荐指数
1
解决办法
1997
查看次数

标签 统计

r ×2

cron ×1

crontab ×1

regex ×1

terminal ×1