Digest function will not work

ok so I want to make a hash column based on two other columns I will concatenate.

I thought I could create a mutate like:

mutate(digest = digest(paste(EIN,NAME)))

but it says:

Error : could not find function "digest"

I checked under R Packages -> Installed Packages -> Core Packages it says:

digest 0.6.11

so I know it’s installed but the function does not show up.

Am I missing something?

You need to attach (load) the package to each project where you want to use it. Can you check this first?

Looks like our document (blog post) was missing this one important step for some reason… :frowning:

Anyway, I’ve fixed the doc as well.

https://blog.exploratory.io/installing-r-packages-from-cran-in-exploratory-desktop-36eae50cffb0#.kik1hz32q

No option available to add packages / scripts to my project

Also tried to manually load the library.

So, it looks like, you can attach packages that are in the “User Packages” but you can’t attach packages from the “core packages”

Oh I see. I’ve totally forgot about ‘digest’ package being actually part of the core packages. This is one area we have overlooked, let us see what we can do here.

Meanwhile, can you try to use ‘anonymizer’ package, which can make a hash as well, it actually uses ‘digest’ internally, I believe.

Thanks for looking into it.

aside - I actually have to vectorize digest first…
so, I’d need to do

vdigest <- Vectorize(digest) 

and then I could

mutate(digest = vdigest(paste(EIN,NAME)))

That seems not possible in Exploratory?

I’ll try anonymizer.

This worked for me.

mutate(digest = anonymize(paste(EIN,NAME)))

Thanks!

1 Like

Actually, I’ve just found a workaround to make this work. You can user ‘R script’ where you type the following.

library(digest)

then you can start using it. I could use ‘digest’ command directly like below.

1 Like

1 Like

Actually, it turned out, you can use ‘namespace’ to call the functions that are already installed as part of the core package. So it could be something like,

mutate(digest = digest::digest(paste(EIN,NAME)))
1 Like

very cool! Thanks! so much!

1 Like