如何告诉big.matrix将某些列视为向量

如何告诉big.matrix将某些列视为向量,r,r-factor,R,R Factor,我有一个大数据集,包括许多不同值的字符变量。我试图将数据读取为big.matrix,然后使用biglm.big.matrix构建线性模型。但是,由于big.matrix将所有字符向量转换为因子,字符标签将丢失。我决定在R之外为我的字符列创建一个查找表,并使用数字来表示R的不同级别。但是,我不知道如何区分big。矩阵这些列应该被视为因子,而不是数字。请帮忙 我不太熟悉read.table.ffdf但是你能用它的x参数吗?从?read.table.ffdf: x NULL or an opti

我有一个大数据集,包括许多不同值的字符变量。我试图将数据读取为
big.matrix
,然后使用
biglm.big.matrix
构建线性模型。但是,由于
big.matrix
将所有字符向量转换为因子,字符标签将丢失。我决定在R之外为我的字符列创建一个查找表,并使用数字来表示R的不同级别。但是,我不知道如何区分
big。矩阵
这些列应该被视为因子,而不是数字。请帮忙

我不太熟悉
read.table.ffdf
但是你能用它的
x
参数吗?从
?read.table.ffdf

x
   NULL or an optional ffdf object to which the read records are appended. If this is provided,
   it defines crucial features that are otherwise determnined during the 'first' chunk of
   reading: vmodes, colnames, colClasses, sequence of predefined levels. In order to also read
   the first chunk into such predefined ffdf, an x with 1 row is treated special: instead of
   appending the first row will be overwritten. This is necessary because we cannot provide x 
   with zero rows (we cannot create ff vectors with zero elements).

您可以将
x
中的相应列定义为具有给定级别的因子,然后将其用作模板。

谢谢@mdsummer。当我回答这个问题时,题目是“如何使用read.table.ffdf将数值向量作为因子来读取”哦,呜呜-OP现在也在问r-help