[R] Read text file

William Dunlap wdunlap at tibco.com
Thu Jun 18 07:26:31 CEST 2015


I am not sure what you mean by "a block", but you can probably use
scan() instead of read.table():
  > txt <- "1 21 41 61 81"
  > d <- data.frame(Numbers=scan(text=txt, what="numeric", quiet=TRUE))
  > d
    Numbers
  1       1
  2      21
  3      41
  4      61
  5      81


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, Jun 17, 2015 at 10:10 PM, Steven Yen <syen04 at gmail.com> wrote:

> How do I read a block of space-delimited numbers into a column vector
> using the read.table command? Thank you.
>
> --
> Steven Yen
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list