i'm going python r , wanted compare 2 things use dict
doing this:
dict_one = {'a': 1, 'b': 2, 'c': 3} dict_two = {'a': 1, 'b': 2, 'c': 4} key1, value1 in dict_one.items(): if dict_two[key1] != value1: print(key1) #prints c
is there similar r? i've made 2 named lists
list_one <- list(a = 1, b = 2, c = 3) list_two <- list(a = 1, b = 2, c = 4)
i tried this, didn't output looking for.
> list_one %in% list_two [1] true true true #looking true true false
you can (this take consideration possible different ordering in list):
> unlist(list_two[names(list_one)])!=unlist(list_one) b c false false true
Comments
Post a Comment