Saturday, April 27, 2024
No menu items!
HomeData Analytics and VisualizationHow to shorten URLs with R

How to shorten URLs with R

In this tutorial we will see how we can shorten URL using R programming language. APIs used in the tutorial are free and do not require any registration or sign-up before using them. This is especially useful when you need to share some links with the team. Long URLs do not look attractive and error prone in copy paste.

In the code below, we are using is.gd and v.gd API services. The only difference between them is that v.gd shows link preview and does not redirect automatically to the original long URL. Whereas is.gd will take you to the original automatically without showing any preview. By default linkPreview is set FALSE in the below user defined R function.
library(httr)
library(jsonlite)

ShortURL  
  api   query   request   content   result  
  return(result)
 
}

ShortURL(“https://www.listendata.com/2021/01/run-sas-in-python-without-installation.html”)

Test if shortened URL is working

Shorter browseURL(Shorter$shorturl)
Read MoreListenData

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments