Why do I get an error of can't make a table of more 2^31 elements in R

前端 未结 5 596
灰色年华
灰色年华 2020-12-10 16:37

Hello I have a dataframe record in R of dimension 8 obs 60 variables , with the missing values replaced by NA and the other values being words.

When I try

5条回答
  •  独厮守ぢ
    2020-12-10 17:30

    The main issue is the complicating levels in your data frame. There are two ways to get around this problem:

    1. invoke droplevels after subsetting the data.frame. For example:

      feeds <- droplevels(record)

    2. Use apply family functions, like sapply someone mentioned earlier. For example:

      feeds <- apply(record,1,table) # output stored as an object feeds

    Good luck.

提交回复
热议问题