[R] c(), or cat(), or paste(), all cause unwanted reordering

Henrique Dallazuanna wwwhsd at gmail.com
Thu Mar 25 20:11:01 CET 2010


Maybe:

gsub("^(.*)$", "..\\1...", "a string")

On Thu, Mar 25, 2010 at 3:53 PM, Jeff Brown <dopethatwantscash at yahoo.com> wrote:
>
> Hi,
>
> I would expect the following:
>
> paste(
>        as.character( cat( rep( ".", 2 ) ) ),
>        "a string",
>        as.character( cat( rep( ".", 3 ) ) )
> );
>
> to yield this string: ". . a string . . .", but instead it yields this:
>
>> . .. . .[1] " a string "
>
> The third argument has been stuck immediately after the first.  The same
> thing happens with cat() or c(). What's going on?
>
> Thanks,
> Jeff
>
> --
> View this message in context: http://n4.nabble.com/c-or-cat-or-paste-all-cause-unwanted-reordering-tp1691133p1691133.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list