我已经尝试过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)
任何帮助都会很棒.
出于某种原因,我的R脚本不会与crontab一起运行.我现在每分钟都有它进行测试,但一旦工作就会改变它.
有任何想法吗?
* * * * * Rscript “/Users/Home/Desktop/David Studios/Scraper/compiler.R”
Run Code Online (Sandbox Code Playgroud)
此外,这只是终端中的正常命令.