Skip to content
Prev 35286 / 63424 Next

binary string conversion to a vector (PR#14120)

Just responding to some of the issues in this long post:

(1) Don't rely on the printed form of an object to decide whether or not 
they are identical.  The function str() is very useful in this regard, 
and sometimes also unclass().  To see whether two object are identical, 
use the function identical()

 > qvector <- c("0", "0", "0", "1", "1", "0", "1")
 > qvector[1]
[1] "0"
 > noquote(qvector[1])
[1] 0
 > str(noquote(qvector[1]))
Class 'noquote'  chr "0"
 > as.integer(qvector[1])
[1] 0
 > str(as.integer(qvector[1]))
 int 0
 > identical(noquote(qvector[1]), as.integer(qvector[1]))
[1] FALSE
 >

Does this alleviate the concern as to the possibility of a bug in 
noquote/as.integer? Or were there deeper issues?

(2) to see how some other users of R have package up miscellaneous 
functions that might be of use to other people, look for packages on 
CRAN with "misc" in their names -- I see almost 10 of them.  The problem 
with just posting snippets of code is that they get lost in all the 
other posts here, and many long term R users have dozens if not hundreds 
of their own functions that are streamlined for their own frequent tasks 
and style of programming.

(3) sounds like a great idea to use R to bring statistical rigor into 
the analysis of the performance of combinatorial optimization algorithms!

(4) install.packages("stringr") works fine for me.  Maybe it was a 
temporary glitch?  Have you checked whether you have a valid repository 
selected?  E.g., I have in my .Rprofile:
options(repos=c(CRAN="http://cran.cnr.Berkeley.edu" , 
CRANextra="http://www.stats.ox.ac.uk/pub/RWin"))

Enjoy learning R!

-- Tony Plate
Franc Brglez wrote: