analyse linkedin R

Analyze LinkedIn with R


Some time ago I saw an interesting post in a R related group on LinkedIn. It was from Michael Piccirilli and he wrote something about his new package Rlinkedin. I was really impressed by his work and so I decided to write a blog post about it.

Get the package

The package is currently just available via GitHub. But thanks to devtools it is not a problem to install it.

Authenticate with LinkedIn

In the next step we have to connect to the LinkedIn API via oAuth 2.0. You have two possibilities in the Rlinkedin package.

You can just use

to use a default API key for getting LinkedIn data.


You can use your own application and application credentials to connect to the API.

Therefore you have to create an application on  LinkedIn. Go on and log in with your LinkedIn account. Then click on “Add new Application”.


On the next page you can see app settings. Just set them as you can see on the following screenshots:

app_setting1 app_setting2


Then click on “Add application” and you get forwarded to your app´s credentials. Switch back to R and set the following variables:

Then you can authenticate with:

After a successful authentication you start to get some data.


Analyze LinkedIn with R

Michael created a nice overview of the different functions on the package´s GitHub page. So I will just show you here a small sample analysis.

First, lets download all your connections with:

This creates a data frame with all available information about your connections. For our analysis we will get the column “industry” which is the industry the person is working in. We will use it to create a small word cloud.

We will then transform this text with some standard word cloud to a nice looking industry overview:

This will create a word cloud like the following:



Julian Hillebrand

During my time at university and learning about the basics of economics I started heavily exploring the possibilities and changes caused by digital disruptions and the process of digital transformation, whereby I focused on the importance of data and data analytics and combination with marketing and management.
My personal focus of interest lies heavily on technology, digital marketing and data analytics. I made early acquaintance with programming and digital technology and never stop being interested in following the newest innovations.

I am an open, communicative and curious person. I enjoy writing, blogging and speaking about technology.

  • Pingback: r links | Graph computing for the Arts()

  • Pingback: Distilled News | Data Analytics & R()

  • Pingback: Analyze This! Analyzing LinkedIn using R | n!Factorial Analytical Sciences()

  • Anil Kumar

    Great tutorial,
    after the data get into data frame can i able to perform any analytics of my use case .What type of use cases can be possible after getting data into data frame .can u suggest me 2 or 3 use cases ?
    Can u give more tutorials on that ,how can we use any sentimental analytics using the data that i loaded from Linkedin.?
    Thanks ,
    Anil Kumar

    • Hey
      please take a look about sentiment analysis on twitter data. This should give you a good starting point as you can easily modify it to use it for LinkedIn data.


  • Mikkel

    Hi there Julian

    I’m totally new with R, and I get an error while trying to process the last long segment of code. The error shows up like this:

    > clean_text = clean.text(text)
    > tweet_corpus = Corpus(VectorSource(clean_text))
    Error: could not find function “Corpus”
    > tdm = TermDocumentMatrix(tweet_corpus, control = list(removePunctuation = TRUE,stopwords = stopwords(“english”), removeNumbers = TRUE, tolower = TRUE))
    Error: could not find function “TermDocumentMatrix”
    > #install.packages(c(“wordcloud”,”tm”),repos=””)
    > library(wordcloud)
    Error in library(wordcloud) : there is no package called ‘wordcloud’
    > m = as.matrix(tdm) #we define tdm as matrix
    Error in as.matrix(tdm) : object ‘tdm’ not found
    > word_freqs = sort(rowSums(m), decreasing=TRUE) #now we get the word orders in decreasing order
    Error in : object ‘m’ not found
    > dm = data.frame(word=names(word_freqs), freq=word_freqs) #we create our data set
    Error in data.frame(word = names(word_freqs), freq = word_freqs) :
    object ‘word_freqs’ not found
    > wordcloud(dm$word, dm$freq, random.order=FALSE, colors=brewer.pal(8, “Dark2”)) #and we visualize our data
    Error: could not find function “wordcloud”

    Am I missing some packages or something in my R-setup?

  • Mikkel

    Never mind!

    I just had to remove the “#” from the “install.packages(c)….” line in order to install the correct packages. Awesome tutorial btw. I got a nice looking result after a bit of trial and error 🙂

    • Hey sorry for the late answer. But thanks for your kind words.


  • Pingback: R software and data visualization | Unstable Textuality Research()

  • jorge del rio

    Julian, is it possible to download the network from other person? i.e., visualize the network of a friend? Thanks!

  • Maggi

    Hi, I downloaded Rlinkedin package
    package ‘XML’ successfully unpacked and MD5 sums checked
    package ‘httpuv’ successfully unpacked and MD5 sums checked
    package ‘Rlinkedin’ successfully unpacked and MD5 sums checked

    But getting the following error

    > in.auth <- inOAuth()
    Error: could not find function "inOAuth"

    • Hey Maggi,
      did you use
      before calling the inOAuth() function?


  • I used to be able to connect about year and half ago with OAuth1.0. Tried using my app using OAuth2.0 but nothing opens up on localhost:1410 I get the Page not found error

    Has anything changed from LinedIn side that would cause it to stop working ?

    Thanks for the post

    • thanks for your comment Rahul. I will take a look at it.

      • Pankaj

        Do we have any updates on this error? Error in init_oauth1.0(self$endpoint, self$app, permission = self$params$permission) :

        client error: (403) Forbidden

  • This is the error I am getting

    Error in init_oauth1.0(self$endpoint, self$app, permission = self$params$permission) :
    client error: (403) Forbidden

  • Wilbur

    I am getting the “webpage not available” error when I try to authenticate via OAuth2.0, any solution to this?

    • Julian Hillebrand

      could you please show me the exact code you used?


  • Swarnava Mitra

    I keep getting the error Firefox can’t establish a connection to the server at localhost:1410.

    • Julian Hillebrand

      could you please show me the exact code you use?


  • Anvitha Ra

    I tried using getMyConnections(in.auth) in Rstudio but ended up with below error:

    Error in x.list[sapply(x.list, is.list)] <- NA :

    invalid subscript type 'list'

    Can someone pls help??

    • Same error here. I am just starting with R and have no clue. Have you found a workaround?

  • wiseyoungbuck

    I was excited to find this, but has anyone used it since LinkedIn closed their API? It seems like it has a lot more limited functionality.

  • ayush

    Hi, Anyone is still able to use this package. i am not able to work around on this package as most of the function are not working due to some limited access by linkedin.

    Is there any other way to get the access of group post using R?

  • sas

    I am using RStudio in the official docker container.
    When I try to connect to linkedin as it is described above, but I am getting error.
    I getting to: “Sign in to LinkedIn and allow access:”, but when it want to forward the page not accessible.

    I am trying with
    and also
    setup, even I added both just in case…
    This is what I can not access..–d05113c4-721d-40cd-855b-70d35dccdab2&oauth_verifier=57445

    Any idea how to run this from inside docker?

  • Mayi Olga

    Hi, is it possible to extract information from a company? It’s that I have a job on some universities in this social network

    • pero magdy

      kindly I am working in similar research can you please send me an your mail to if you have any social network dataset or have any method to download it from any network

  • The LinkedIn API is best now. The changes in request-able data and the format of those calls has rendered a significant majority of the RLinkedin package’s access to LinkedIn data disabled.

    Luckily, after you signup as a LinkedIn developer, it is very easy to use with in httr or your favorite web request tools. No need for rvest or any scrapping (even trying is a hassle – in addition to being against the LinkedIn toc – trust me).
    Unfortunately, easy and more direct access comes at the invaluable loss of accessible data range or diversity. You can grade plenty of your information easy enough, but reaching outside that is pretty restricted.
    NOTE: you can submit your app for approval which will provide you access to a broader range of data – even then, don’t plan on being able to crawl to far from your own page.

  • Anmol Parimoo

    Hey I am unable to execute any of these queries even after successful authentication. It requires me to be a partner, which I am unable to understand. Please help me out. Thanks.

    • Gates Cao

      Unfortunately, LinkedIn closed its open API to developers 2 years ago. Now you need to apply for their partnership program to have access to the data.

      • j

        what is the solution?

      • mahesh

        i’m create my partnership program but its not a access api

  • Eiliza

    I love this post.

    โปรโมชั่นGclub ของทางทีมงานตอนนี้แจกฟรีโบนัส 50%
    เพียงแค่คุณสมัคร Gclub กับทางทีมงานของเราเพียงเท่านั้น
    สมัครสมาชิกที่นี่ >>> Gclub online

  • iggy

    Very cool!

    เว็บไซต์คาสิโนออนไลน์ที่ได้คุณภาพอับดับ 1 ของประเทศ
    เป็นเว็บไซต์การพนันออนไลน์ที่มีคนมา สมัคร Gclub Royal1688
    และยังมีเกมส์สล็อตออนไลน์ 1688 slot อีกมากมายให้คุณได้ลอง
    สมัครสมาชิกที่นี่ >>> Gclub Royal1688

  • Samaresh Yadav

    Hey Hi, I tried a lot using R but its hopeless. is there any other process to extract linkedin data using R or Any programming languages. please let me know.