title: How to do people search based on keywords using linkedin api in R?
body: <p>I am trying to extract profile search data based on keywords. It is showing access is denied. </p>
  
  <p>1) How to get people search data using linkedin api in R ? (But I am getting data on apigee rest console) . </p>
  
  <p>2) What is the best way store XML data as Data Frame in R? When there is a differ in rows between root node?</p>
  
  <p>Below is my code. </p>
  
  <pre><code>library(httr)
  library(XML)
  
  oauth_endpoints("linkedin")
  
  myapp &lt;- oauth_app("Profile Search", key  = "785mvlu4741k9o", secret="DMRmtjDfFo4ncLzg")
  
  TokenLinkedIn &lt;- R6::R6Class("TokenLinkedIn", inherit = Token2.0, list(
    sign = function(method, url) {
      url &lt;- parse_url(url)
      url$query$oauth2_access_token &lt;- self$credentials$access_token
      list(url = build_url(url), config = config())
    },
    can_refresh = function() {
      TRUE
    },
    refresh = function() {
      self$credentials &lt;- init_oauth2.0(self$endpoint, self$app,
                                        scope = self$params$scope, type = self$params$type,
                                        use_oob = self$params$use_oob)
    }
  ))
  
  token &lt;- TokenLinkedIn$new(
    endpoint = oauth_endpoints("linkedin"),
    app = myapp,
    params = list(use_oob = FALSE, scope = NULL, type = NULL)
  )
  
  homeTL&lt;- GET("https://api.linkedin.com/v1/people-search:(people:(first-name,last-name,headline,industry,email-address))?keywords=client%20engagement"
  , config(token = token))
  
  homeTL
  # I am getting below error message as Access to people search denied.
  #&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  #&lt;error&gt;
    #&lt;status&gt;403&lt;/status&gt;
    #&lt;timestamp&gt;1425299488038&lt;/timestamp&gt;
    #&lt;request-id&gt;JXQYYV5V0Z&lt;/request-id&gt;
    #&lt;error-code&gt;0&lt;/error-code&gt;
    #&lt;message&gt;Access to people search denied.&lt;/message&gt;
  # &lt;/error&gt;
  
  
  doc &lt;- xmlTreeParse(homeTL,useInternal=TRUE)
  rootNode &lt;- xmlRoot(doc)
  Id&lt;-xpathSApply(rootNode,"//id", xmlValue)
  firstname&lt;-xpathSApply(rootNode,"//first-name", xmlValue)
  lastname&lt;-xpathSApply(rootNode,"//last-name", xmlValue)
  industry&lt;-xpathSApply(rootNode,"//industry", xmlValue)
  
  Link=data.frame("Id"=Id,"FirstName"=firstname,"LastName"=lastname)
  
  ## While including industry rows showing error 
  #Error in data.frame(Id = Id, FirstName = firstname, LastName = lastname,  : 
    #                    arguments imply differing number of rows: 842, 786 
  </code></pre>