Skip to content
Prev 28038 / 63424 Next

resampling from string when it runs across multiple lines

try this:

y <- as.matrix(read.table(textConnection(
"A     C     G     T     T     G     C     A     G      C
A     C     G     F     F     F     F     F     F      G
A     C     G     S     S     S     S     S     G      A
A     C     G     T     T     G     C     A     G      G
A     B     B     B     B     B     B     A     G      T"
), stringsAsFactors = FALSE))

ind <- sample(length(y), 20, TRUE)
y[ind]

I hope it helps.

Best,
Dimitris

ps, it would be best that you send that kind of e-mails in R-help not  
R-devel; check http://www.r-project.org/mail.html for more info  
regarding the different R-mailing-lists.

----
Dimitris Rizopoulos
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
      http://www.student.kuleuven.be/~m0390867/dimitris.htm


Quoting Suraaga Kulkarni <suraaga.kulkarni at gmail.com>:
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm