Loading JSON data in R

I need:

  • Download the analyzed file of all company names provided by http://api.crunchbase.com/v/1/companies.js

  • Run a query using the name of each company to download an analyzed file of each information about the company (for example, Founded_year, name of the sponsoring company) using the syntax "http://api.crunchbase.com/v/1/company/permalink.js

I would like to analyze this data in a spreadsheet or some other format that I can then import into R for analysis.

What is the best format for importing this data into R? How to download data and organize it in a table? (e.g. Row = company, columns = profile information such as funded_year) (with the ultimate goal of analyzing it in R)

+4
source share
1 answer
library(RJSONIO) library(RCurl) # grab the data raw_data <- getURL("http://api.crunchbase.com/v/1/companies.js") # Then covert from JSON into a list in R data <- fromJSON(raw_data) length(data) [1] 101782 # We can coerce this to a data.frame final_data <- do.call(rbind, data) # Then write it to a flat csv file write.csv(final_data, "final_data.csv") > head(final_data) name permalink category_code [1,] "Wetpaint" "wetpaint" "web" [2,] "AdventNet" "adventnet" "enterprise" [3,] "Zoho" "zoho" "software" [4,] "Digg" "digg" "web" [5,] "Facebook" "facebook" "web" [6,] "Photobucket, Inc." "photobucket" "web" 
+8
source

Source: https://habr.com/ru/post/1441182/


All Articles