Re: [R] representing binary data for Genetic Algorithm in R

From: Thibaut Jombart <>
Date: Sun, 20 Apr 2008 18:23:49 +0200

Dear Esmail,

you really have to have a look at some introduction to R (e.g., but see the "Manual" section in R website ( That would answer many of your questions.

>Hello all,
>I am trying to implement a simple Genetic Algorithm. I am doing this
>in R since I want access to the statistical functions (eg lm) it
>I'm not new to programming, or GAs, but I am totally new to R (the
>package and the language), and I am hoping someone could help with
>these questions:
>1. I am going to use a binary representation, it seems that vectors of
> Factors would be what I should use? I would specify values of
> TRUE/FALSE instead? Or is there a better choice for manipulating
> binary strings? Does this seem like a legitimate way to create a
> random one: sample(0:1, vec_size, replace=T)
Factors are nice to manipulate binary strings (they use integers as internal representation).

>2. Am I correct in assuming that R is interpreted (and hence is going to
> be noticeably slower than compiled languages)?
Yep. But you can have R call C and Fortran code as well.

>3. Is there some sort of debugging facility?

>4. Does anyone know how to do an effective search for R in google (or
> other search engines). The fact that this is a single letters seems
> to have most applications ignore this input. This might help me in
> finding answers to some other basic questions I have (such as is
> there an equivalent function to "printf" in R? "cat" and "print"
> are not quite working right for me -- but I need to dig deeper into
> the documentation)
Functions: ?,, apropos, RSiteSearch. See also

>I am not sure if this belongs into the help or development group, so
>I'm giving this a try. If this is the wrong group to post in, please
>let me know and I'll repost.
Instructions and posting guide are there:

>There will probably be more elementary questions (I am reading the
>various manuals too .. but if anyone has some other favorite sites
>they want to recommend please do so)
>ps: I there a USENET group dedicated to R?
>pps: I am also exploring ways of calling R functions from Java, if
> anyone has any comments regarding that please share.
See the rJava package.



CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. :
Fax :

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Sun 20 Apr 2008 - 16:34:43 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 Mon 21 Apr 2008 - 06:30:30 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive