how can I replicate working of Multi Label Binarizer from sklearn package in R? I want to achieve same working of MultiLabelBinarizer from sklearn.preprocessing package in R. I have list of labels for each example (for Predicated and Actual) like below.

[[1]][1] "a"      "b"      "d"    "f"
[[2]][1] "g"      "b"      "f"    "d"
....


what I want is to get this in -

[[1 1 0 1 0 1 ...]
[0 1 0 1 0 1 1 ..]]...

So that I can get it in the form for multilabel_confusion_matrix.
One way to do this is to convert the source code from Python to R - see line 289 here.

You could also check for functionality in existing R packages - for instance, mldr, mlr or caret packages.