keep.RdKeep or drop variables
keep(K, yes)
discard(K, no)Function keep(omega,yes) keeps the terms specified and
discard(omega,no) discards the terms specified. It is not clear
to me what these functions mean from a mathematical perspective.
The functions documented here all return a kform object.
(o <- kform_general(7,3,seq_len(choose(7,3))))
#> An alternating linear map from V^3 to R with V=R^7:
#> val
#> 2 5 6 = 18
#> 4 5 6 = 20
#> 3 4 6 = 16
#> 2 4 6 = 15
#> 1 5 7 = 27
#> 1 2 4 = 2
#> 1 3 6 = 12
#> 2 4 5 = 9
#> 1 4 5 = 8
#> 2 3 5 = 7
#> 1 3 5 = 6
#> 1 4 6 = 14
#> 2 3 6 = 13
#> 2 3 7 = 23
#> 1 4 7 = 24
#> 1 3 7 = 22
#> 2 4 7 = 25
#> 3 4 7 = 26
#> 4 5 7 = 30
#> 3 5 7 = 29
#> 1 6 7 = 31
#> 2 3 4 = 4
#> 1 2 7 = 21
#> 2 5 7 = 28
#> 3 6 7 = 33
#> 3 4 5 = 10
#> 1 2 6 = 11
#> 4 6 7 = 34
#> 1 2 3 = 1
#> 5 6 7 = 35
#> 3 5 6 = 19
#> 2 6 7 = 32
#> 1 2 5 = 5
#> 1 5 6 = 17
#> 1 3 4 = 3
keep(o,1:4) # keeps only terms with dimensions 1-4
#> An alternating linear map from V^3 to R with V=R^4:
#> val
#> 1 3 4 = 3
#> 1 2 3 = 1
#> 2 3 4 = 4
#> 1 2 4 = 2
discard(o,1:2) # loses any term with a "1" in the index
#> An alternating linear map from V^3 to R with V=R^7:
#> val
#> 3 5 6 = 19
#> 5 6 7 = 35
#> 4 6 7 = 34
#> 3 4 5 = 10
#> 3 6 7 = 33
#> 3 5 7 = 29
#> 4 5 7 = 30
#> 3 4 7 = 26
#> 3 4 6 = 16
#> 4 5 6 = 20