Author Login
Post Reply
I am new to R, so I beg your indulgence.
> a='hello world'
> if (grep('hellow',a)) {
print("wow")
} else {
print("wow2")
}
Error in if (grep("hellow", a)) { : argument is of length zero
What is the proper syntax to ensure that "wow2" gets printed?
Thank you for your help!
Dan
[[alternative HTML version deleted]]
______________________________________________
R-help@(protected)
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.