How do I read a block of space-delimited numbers into a column vector using the read.table command? Thank you. -- Steven Yen
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]]
Hi, I think that you need scan() but you should at least give us an example of your text data. Olivier. -- Olivier Crouzet LLING - Laboratoire de Linguistique de Nantes - EA3827 Universit? de Nantes -----Original Message----- From: Steven Yen <syen04 at gmail.com> Sender: "R-help" <r-help-bounces at r-project.org>Date: Thu, 18 Jun 2015 01:10:39 To: r-help<r-help at r-project.org> Reply-To: syen04 at gmail.com Subject: [R] Read text file 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.