(2/3) The Intermediate Example

Second example! Let's lookup something related to an entity. Concrete example: we want to know how experienced the investors of a certain organization really are.

Setup

Before you do anything else, you will need to install and load the library cruncher into your workspace. You can use devtools to get cruncher. After you have installed it, simple load it by calling the following command.

# Load cruncher
library(cruncher)

# Set your api key with research access via
setAPIKey()

Please note that all the functions in this example will fail unless you've specified your API_KEY. As soon as you've done this, they will return to you the requested data, provided you have the research access to the Crunchbase API.

Pagination Made Easy

Now let's get the information about the investors of, let's say, Facebook.

# Lookup card (will paginate if necessary)
investors <- lookupOrganizationCard(organization_card = "investors", organization_id = "facebook")

When you run the above command, you will notice that the returned object is a list that you can view and inspect further. The data we are interested in is in page_1. More pages would be added if the limit of 100 entries per page for the first page had been exceeded.

# Lookup card (will paginate if necessary)
investors_info <- investors$page_1

Now you have already a data.frame with information about the investors of Facebook and can read out from the provided variables e.g. how many investments a particular investor has made in the past. That's as simple as it gets :)

Conclusion

We have taken it a step further and looked at beyond the basic properties of an entity to look through another specific card. But until now, we still assume we know about which specific entity we want to have information about, i.e. we know its permalink or uuid which are required for the Entity Lookup API endpoint. In the advanced example, we throw this assumption out of the window and get serious! See you there!



Lyrohk/cruncher documentation built on Dec. 17, 2021, 1:17 a.m.