In [1]:
library('tidyverse')
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
In [7]:
rules_df <- read.table('rules.txt', sep='|')
In [9]:
data_df <- read.table('data.txt')
In [41]:
data_df_list <- str_split(data_df$V1, ',')
In [42]:
data_df_list[1]
Out[42]:
    1. '13'
    2. '19'
    3. '52'
    4. '14'
    5. '65'
    6. '96'
    7. '62'
    8. '98'
    9. '58'
    10. '73'
    11. '97'
    12. '92'
    13. '91'
    14. '87'
    15. '44'
    16. '54'
    17. '42'
In [48]:
for (i in length(data_df_list)){
   x1<-as.vector(data_df_list[i])
    x2<-as.numeric(x1)
}
Error: 'list' object cannot be coerced to type 'double'
Traceback:
In [46]:
as.vector(data_df_list[1])
Out[46]:
    1. '13'
    2. '19'
    3. '52'
    4. '14'
    5. '65'
    6. '96'
    7. '62'
    8. '98'
    9. '58'
    10. '73'
    11. '97'
    12. '92'
    13. '91'
    14. '87'
    15. '44'
    16. '54'
    17. '42'
In [26]:

Error in `check_match()`:
! `match` must be a character vector of non empty strings.
Traceback:

1. contains(., V1, 46)
2. check_match(match)
3. cli::cli_abort("{.arg match} must be a character vector of non empty strings.")
4. rlang::abort(message, ..., call = call, use_cli_format = TRUE, 
 .     .frame = .frame)
5. signal_abort(cnd, .file)
6. signalCondition(cnd)
In [34]:
class(data_df_list[[1]])
Out[34]:
'list'
In [40]:
data_df_list
Out[40]:
A matrix: 223 × 23 of type chr
13195214659662985873⋯87445442131952146596
26119384954563892765⋯93849545638927655526
97579526733481915464⋯95267334819154647497
74914262872753988192⋯63576796263474914262
87559465919844146978⋯89818755946591984414
26958493684835764738⋯89551275696514521322
67916292643719265881⋯67916292643719265881
95389489691344953894⋯44953894896913449538
76473811942489551275⋯13227896987381877647
19979264577437636727⋯93684845381119979264
74623767923834579374⋯92383457937462376792
65425873979253548757⋯81529614654258739792
87915853996219976474⋯67959368879158539962
98112414895222557547⋯38919681658794699811
53996254979264376334⋯95849368483576455399
94248955756914524473⋯53999424895575691452
76454738942489551275⋯52132244789673877645
63376889243811842794⋯34644535675774267647
54265319279158879257⋯95936284689754265319
89551269651452132278⋯87914258539962548955
57743763346727846848⋯38245512577437633467
97645767454724976457⋯24976457674547249764
55952735754768943438⋯48849311896926761224
63272695936835764547⋯89656327269593683576
93684845389368484538⋯45389368484538936848
75691322967387629275⋯96738762927569132296
54927434278468351154⋯27846835115492743427
91425862549792577463⋯93489142586254979257
53198713647496147358⋯87136474961473589253
63678435764789556563⋯76478955656367843576
⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋱⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮
35264767749394453427⋯47677493944534279535
73344498642219733444⋯19733444986422197334
53746334954845537463⋯45537463349548455374
91425853996254199792⋯67272695934891425853
92389337116345277495⋯92389337116345277495
67358434627457482763⋯84346274574827639767
44425853995464576744⋯99546457674442585399
91193787229274579681⋯91193787229274579681
24358493698965476324⋯69896547632435849369
84936848357645471194⋯12756965132244788493
38119424895512756965⋯78969873819142583811
75659873879154756598⋯54756598738791547565
38939792951934375768⋯45546762486484353893
89551275696514224478⋯87914258539962548955
26958493684835764538⋯89551275696514132695
53545297229965146912⋯98424487629678135354
48939467894738645735⋯63556811377648939467
64577463346726487645⋯89556457746334672648
73891344144776756545⋯69783511948196987389
84934876454738119424⋯69651413224484934876
97548719917569995296⋯62659754871991756999
24698778551358221196⋯89382469877855135822
62197427958438621974⋯38621974279584386219
58996254979264577463⋯95849368487658996254
14132287425853625497⋯14132287425853625497
48972638843427639495⋯35643719456848972638
27697576129547686745⋯35939484143424482769
87525514134794246965⋯45388981987375221244
52137387915419973752⋯91541997375213738791
34672795849348453811⋯65143467279584934845