Created
August 19, 2022 13:54
-
-
Save MattSandy/14242b5af9dce69102647e2000848bcc to your computer and use it in GitHub Desktop.
Inc. 5000 2022
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(jsonlite) | |
df <- "https://api.inc.com/rest/i5list/2022" %>% | |
fromJSON() %>% | |
.$companies %>% | |
bind_rows() %>% | |
group_by(inc5000companyId) %>% | |
mutate( | |
article = ifelse(is.null(article %>% unlist %>% .[1]),NA,article %>% unlist %>% .[1]), | |
editorsPick = editorsPick %>% unlist %>% paste(collapse = ",") | |
) %>% | |
write_csv("inc.csv") |
Hi Matt,
I figured to extract the company profile from "https://api.inc.com/rest/companyprofile/blockfi" but I'm able to extract the profile of only one company at a time and finding difficulty saving it in .cvs
Any possibility to list out all the 5000 profiles? please help.
library(tidyverse)
library(jsonlite)
df <- "https://api.inc.com/rest/companyprofile/blockfi" %>%
- fromJSON() %>%
- .$profile %>%
- bind_rows() %>%
- group_by(inc5000companyId) %>%
- mutate(
-
article = ifelse(is.null(article %>% unlist %>% .[1]),NA,article %>% unlist %>% .[1]),
-
editorsPick = editorsPick %>% unlist %>% paste(collapse = ",")
- ) %>%
- write_csv("profiles.csv")
Error inmutate()
:
! Problem while computingarticle = ifelse(...)
.
ℹ The error occurred in group 1: inc5000companyId = "130719".
Caused by error inunlist()
:
! object 'article' not found
Runrlang::last_error()
to see where the error occurred.
I came this far with 0 subject in R
Hey Syamjordan
Did you ever figure it out?
Hi Matt, if I want to rerun the list for 2023 is it as simple as changing the URL in the code above to "https://www.inc.com/inc5000/2023"?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I managed to get it working. Used a different CRAN mirror and changed the path.lib to get the packages installed properly. I ran the code and Matt you are a bloody legend. I literally can't thank you enough cause I saved about 3 weeks of my time. God bless you man you are incredible!