问题 I'm trying to implement feature hashing in R to help me with a text classification problem, but i'm not sure if i'm doing it the way it should be. Part of my code is based on this post: Hashing function for mapping integers to a given range?. My code: random.data = function(n = 200, wlen = 40, ncol = 10){ random.word = function(n){ paste0(sample(c(letters, 0:9), n, TRUE), collapse = '') } matrix(replicate(n, random.word(wlen)), ncol = ncol) } feature_hash = function(doc, N){ doc = as.matrix