showkey
showkey

Reputation: 348

Read data into a vector

I am trying to read this data file.

x<-read.table("mydata",header=FALSE)
> mode(x)
[1] "list"

How can I read it as a vector? It can be done with unlist(x), but I want a simpler way.

Upvotes: 2

Views: 409

Answers (1)

QkuCeHBH
QkuCeHBH

Reputation: 960

Via scan:

x <- scan("mydata")

Simple enough?

Upvotes: 6

Related Questions