[R] Strange paste, string or package problem?

From: Thomas Allen <hedbag_at_gmail.com>
Date: Tue, 04 Mar 2008 14:40:35 +1300


Hi

I came across this strange bug the other day, I'm not sure how to solve it and I wonder if anyone can even replicate it.

Using OS Ubuntu 7.10

Step 1) Make an R package using the package.skeleton() command with only these two functions:

error <- function(){

  cmd <- paste(" -a ",1," -a ",1," -a ",1,
               " -a ",1," -a ",1," -a ",1,
               " -a ",1," -a ",1," -a ",1,
               " -a ",1," -a ",1," -a ",1,
               " ľa ",1,sep="")

  cat(cmd,"\n")
}
noerror <- function(){
  cmd <- paste(" -a ",1," -a ",1," -a ",1,
               " -a ",1," -a ",1," -a ",1,
               " -a ",1," -a ",1," -a ",1,
               " -a ",1," -a ",1," -a ",1,sep="")
  cat(cmd,"\n")
}

Step 2) Start R again. Load the package with library() and run the commands: error()
noerror()

I get the following output:
> > library(errors)
> error()


 -a 1 -a 1 -a 1 -a 1 -a 1 -a 1 -a 1 -a 1 -a 1 -a 1 -a 1 -a 1 <e2><80><93>a 1
> noerror()

 -a 1 -a 1 -a 1 -a 1 -a 1 -a 1 -a 1 -a 1 -a 1 -a 1 -a 1 -a 1
>

Now why does that "<e2><80><93>" replace one of the "-" in the first command?

Any ideas?

Cheers

Tom

-- 
Thomas Allen
Department of Biochemistry
University of Otago
email1: hedbag_at_gmail.com
email2: allth025_at_student.otago.ac.nz
Work: (+64)3 479 5123
Mobile: 027 321 4269

______________________________________________
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.
Received on Tue 04 Mar 2008 - 01:48:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 04 Mar 2008 - 07:30:18 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.

list of date sections of archive