r - How to read logical data with header from file -
i want read following table
#logical.table col_a col_b row_a true false row_b false true
the resulting object in r should have column , row names file(at least 1 of them) , logical columns , rows
i tried:
matrix(ncol=2, byrow=t, scan(file = 'logical.table', what=true, skip=1))
miss col/row-names.deleting rownames,
w<-read.table(file='logical.table', colclasses = "logical", header=t)
is.logical(w[1])
,is.logical(w[1,])
return false
solution
derwin mcgeary wrote: x <- read.table(file="logical.table")
works fine. logical columns use x[,col]
, logical rows ended t(x)[,row]
.
the function read.table
smart enough read file , give appropriate row , column names.
x <- read.table(file="logical.table") str(x)
cut , pasted example including line #logical.table
, still worked.
Comments
Post a Comment