Re: [R] Substring error

From: talepanda <talepanda_at_gmail.com>
Date: Thu 25 Jan 2007 - 10:09:25 GMT

It occurs why start or stop could not be converted into integer of length > 0 by using as.interger().

More presicely,
if( !isInteger(sa) || !isInteger(so) || k == 0 || l == 0 ) # c code where sa is start, so is stop, k is length(start), l is length(stop)

For example:

substr("orz",character(0),0)
substr("orz",numeric(0),0)
substr("orz",logical(0),0)
substr("orz",integer(0),0)
substr("orz",NULL,0)

produce the error because of k==0

But there seems to be another case which I don't know.

On 1/25/07, Shubha Vishwanath Karanth <shubhak@ambaresearch.com> wrote:
> Hi,
>
>
>
> Do anybody know when and why the below error we get?
>
>
>
> Error in substr(x, as.integer(start), as.integer(stop)) :
> invalid substring argument(s) in substr()
>
>
>
> Thanks in advance,
>
> Shubha
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> 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.
>



R-help@stat.math.ethz.ch mailing list
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. Received on Thu Jan 25 21:11:37 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 25 Jan 2007 - 11:30:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.