# Post matrix from R

**URL:** https://ask.openrouteservice.org/t/post-matrix-from-r/1963
**Category:** matrix
**Created:** [July 30, 2020, 4:22am UTC](https://ask.openrouteservice.org/t/post-matrix-from-r/1963 "2020-07-30T04:22:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Michel\_de\_Lange](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/michel_de_lange/32/574_2.png) [@Michel\_de\_Lange](https://ask.openrouteservice.org/u/Michel_de_Lange)
#### Post date: [July 30, 2020, 4:22am UTC](https://ask.openrouteservice.org/t/post-matrix-from-r/1963/1 "2020-07-30T04:22:48Z")

</div>

Hi, I am hoping to use Openrouteservice from R. What is the magic invocation to make this work? I have tried the following:

library(curl)  
library(magrittr)  
new\_handle() %\>%  
handle\_setopt(copypostfields =  
“locations=[[9.70093,48.477473],[9.207916,49.153868]]”) %\>%  
handle\_setheaders(“Content-Type”=“application/json”,  
“charset”=“utf-8”,  
“Accept”=“application/json, application/geo+json, application/gpx+xml, img/png”,  
“charset”=“utf-8”,  
“Authorization”=“xxx”) %\>%  
curl\_fetch\_memory(url = “[https://api.openrouteservice.org/v2/matrix/driving-car](https://api.openrouteservice.org/v2/matrix/driving-car)”) %$% content %\>%  
rawToChar %\>% jsonlite::prettify()

But this returns error code 500 server error. What am I doing wrong?

Many thanks.

---

<div class="post-metadata">

### Author: ![amandus](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/amandus/32/669_2.png) [@amandus](https://ask.openrouteservice.org/u/amandus)
#### Post date: [July 30, 2020, 11:50am UTC](https://ask.openrouteservice.org/t/post-matrix-from-r/1963/2 "2020-07-30T11:50:03Z")

</div>

Hi @Michel_de_Lange,

Are you using the [openrouteservice-r](https://github.com/GIScience/openrouteservice-r/) package already?

Best regards

---

<div class="post-metadata">

### Author: ![Michel\_de\_Lange](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/michel_de_lange/32/574_2.png) [@Michel\_de\_Lange](https://ask.openrouteservice.org/u/Michel_de_Lange)
#### Post date: [July 30, 2020, 7:42pm UTC](https://ask.openrouteservice.org/t/post-matrix-from-r/1963/3 "2020-07-30T19:42:36Z")

</div>

I didn’t know about the openrouteservice-r package. Just what I need, thank you!  
With best regards,  
Michel
