[R] representing binary data for Genetic Algorithm in R
Thibaut Jombart
jombart at biomserv.univ-lyon1.fr
Sun Apr 20 18:23:49 CEST 2008
Dear Esmail,
you really have to have a look at some introduction to R (e.g.
http://cran.r-project.org/doc/manuals/R-intro.pdf), but see the "Manual"
section in R website (http://www.r-project.org/). 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
>provides.
>
>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?
>
?debug
>
>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: ?, help.search, apropos, RSiteSearch. See also
http://www.rseek.org/.
>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:
http://www.r-project.org/mail.html
>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)
>
>Thanks,
>Esmail
>
>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.
Regards,
Thibaut.
--
######################################
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
jombart at biomserv.univ-lyon1.fr
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://adegenet.r-forge.r-project.org/
More information about the R-help
mailing list