R read matrix of integer values automatically -


i want read matrix (all values, no null or empty column) tab-separated text file of integers , name columns automatically (based on titles in first line):

a   b   c 9   2   3 2   9   6 3   2   4 5   3   3 

i have tried read.csv(), read.table() , scan() methods , read file, want that:

1- automatically identifies column names (no need mention names 1 one).

2- able treat them matrix of integers; run rcorr(data) , quantile(data$a, 0.9) instead of rcorr(as.matrix(data)) , quantile(as.matrix(data$a), 0.9) time.

any ideas on simplest (yet efficient) way?

how read.table?

read.table(text="a b c                  9 2 3                  2 9 6                  3 2 4                  5 3 3", header=true)  >      b c      1 9 2 3      2 2 9 6      3 3 2 4      4 5 3 3 

it has options input file, declare separator, etc.. see help(read.table)


Comments