[This article was first published on R Programming – Pretty Little Numbers, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I have been interested in blockchain technologies and cryptocurrencies for a while now. While doing research I’ve stumbled upon some interesting techniques for picking hidden gems. Many of these techniques required a fair bit of legwork, so in an effort to make things quicker and more efficient I came up with the following.

We will be using a technique for picking out microcap stocks set forth by trader Nik Patel in his article “Picking Out Microcaps 101“, you can find the original article here. I recommend reading it if you haven’t already. Once you get the basics down we are ready to get digging.

If you don’t have the required packages installed you will need to do so. Use the code below to install the crypto and dplyr packages, as well as their required dependencies.

```#install packages
install.packages("crypto")
install.packages("dplyr")
```

Once the packages are installed you will need to load them.

```#load packages
library(crypto)
library(dplyr)
```

Now that the required packages are installed and loaded, we can begin the act of importing and cleaning the data. The code below will pull all of the cryptocurrencies currently listed on CoinMarketCap into a data frame.

```#import data from coinmarketcap
crypto_prices <- crypto_prices()
```

One little hiccup will occur that we need to solve. The crypto package imports one of the columns with a name that starts with a number. If we try to use dplyr on this column it will throw an error. Use the code snippet below to rename that column.

```#change column name to allow for dplyr
colnames(crypto_prices)[colnames(crypto_prices)=="24h_volume_usd"] <- "usd_volume_24h"
```

Ok, so we’ve now got our data loaded and in the correct format. Now it’s time to find our microcap gems!

The variables we care about here are market cap, coin supply, and a ratio of market cap to 24-hour volume. The first two already exist in our data frame, but we will have to create the last one. Luckily for us, we can do that easily with dplyr’s `mutate()` function. After we create the new column, which I have dubbed “mcv_ratio”, we can filter out just the rows that meet the criteria mentioned in Nik’s article. Note: I am using the piping operator to combine these into one step in the name of efficiency.

```#using piping operator
crypto_prices <- crypto_prices %>%
mutate(mcv_ratio = (usd_volume_24h/market_cap_usd)) %>%
filter(market_cap_usd <= 250000, available_supply < 50000000 & available_supply > 0, mcv_ratio > .02)
```

Great! Now we have a data frame with just the currencies we want to focus on. I personally like having two data frames to work with now. The one we just created and a pared down one which will allow me to quickly see names and supply information. I will create a separate data frame with only three columns: coin name, available supply, and total supply. This allows me to quickly compare the columns and disqualify the ones that have evidence of a large premine.

```supply_compare <- select(crypto_prices, name, available_supply, total_supply)
```

That’s it for the code. You should be able to use the remaining tips in Nik’s article to find some pretty interesting tokens. Feel free to comment below with any successes you’ve had.

Oh, and the above references an opinion and is for information purposes only. It is not intended to be investment advice.

I hope you enjoyed this tutorial, happy hunting!

BTC: 3LQjkSZRbSLbC5oajiCLWZHcbGGfzNEp9p
ETC: 0x7474848108F4f84023b0C49572E89aCDCa32D179
LTC: MDsL44XKuTHchRgiHghH5QkaBxjUXfsqn2