Skip to content

fcm_compress drops class  #728

Description

@kbenoit
myfcm <- fcm(tokens(c("b A A d", "C C a b B e")), context = "document")

# make some equivalent dimnames
myfcm@Dimnames[[1]] <- tolower(myfcm@Dimnames[[1]])

## this should not be possible, since an fcm needs to remain symmetric
fcm_compress(myfcm)
# 5 x 7 sparse Matrix of class "dgCMatrix"
#     features
# docs b A d C a B e
#    b 0 2 1 2 1 1 2
#    a . 1 2 . 0 1 1
#    d . . 0 . . . .
#    c . . . 1 2 2 2
#    e . . . . . . 0

## this should be possible, but should retain the fcm class and
## slots
myfcm@Dimnames[[2]] <- tolower(myfcm@Dimnames[[2]])
fcm_compress(myfcm)
# 5 x 5 sparse Matrix of class "dtCMatrix"
#     features
# docs b a d c e
#    b 1 3 1 2 2
#    a . 1 2 . 1
#    d . . 0 . .
#    c . . . 1 2
#    e . . . . 0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions