error2: factor uses the whole data.