[R] character to numeric conversion
Roger Bivand
Roger.Bivand at nhh.no
Mon Mar 19 12:34:26 CET 2007
On Mon, 19 Mar 2007, Robin Hankin wrote:
> Hello everybody
>
> thanks for the tips.
>
> I *think* this should be the same thread....
>
>
> The manpage for system() says that lines of over 8095
> characters will be split. This is causing me problems.
> How do I get round the 8095 character limit?
>
Can you use sed or awk in a pipe externally to change ", " into "\n" while
still out in the system() call, for example the record separator RS in
awk?
>
> Simple toy example follows:
>
>
>
> jj <- system("echo 4 | awk '{for(i=1;i<100;i++){printf(\"%s,\",
> $1)}}'| sed -e \"s/,$//\"",intern=T)
>
>
> This is fine. But .. . .
>
>
> jj <- system("echo 4 | awk '{for(i=1;i<10000;i++){printf(\"%s,\",
> $1)}}'| sed -e \"s/,$//\"",intern=T)
>
>
>
> has "jj" split into three bits, which is upsetting my call. In my
> application
> the split occurs in the middle of a multi-digit number, which messes up
> my conversion to numeric?
>
>
>
>
>
>
>
> --
> Robin Hankin
> Uncertainty Analyst
> National Oceanography Centre, Southampton
> European Way, Southampton SO14 3ZH, UK
> tel 023-8059-7743
>
> ______________________________________________
> R-help at 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.
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-help
mailing list