Re: [R] treating integer(0) and NULL in conditions and loops

2016-03-11 Thread William Dunlap via R-help
I would suggesting using "" instead of NULL for rz, throughout this code. (I would also suggest making sure the code can be copied into R without causing a syntax error before posting the request for help.) Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Mar 11, 2016 at 9:10 AM, Adams, Jean

Re: [R] treating integer(0) and NULL in conditions and loops

2016-03-11 Thread Adams, Jean
To reframe the problem ... the issue is not with the function nchar() (or whatever), it's with the input value rz being null. I suggest you build into the loop whatever actions/outputs you want when rz is NULL. for (i in 1:10){ if (is.null(rz)) { # do something here } else { if (nchar