Import packages
library(data.table)
library(jsonlite)
Generating sample data
url <- paste("https://rdocumentation.org/api/packages/", "dplyr", "/versions/", "0.7.3", sep = "")
dat <- fromJSON(txt = url)
metrics <- data.frame(dat$package_name, dat$version, dat$title, dat$description,
dat$release_date, dat$license, dat$maintainer$name, dat$maintainer$email)
colnames(metrics) <- c("Name", "Version", "Title", "Description", "Release Date", "License", "Maintainer", "Contact")
metrics_data <- data.frame(t(metrics))
colnames(metrics_data) <- "Package Metrics"
head(metrics_data)
## Package Metrics
## Name dplyr
## Version 0.7.3
## Title A Grammar of Data Manipulation
## Description A fast, consistent tool for working with data frame like objects,\nboth in memory and out of memory.
## Release Date 2017-09-09T14:04:29.000Z
## License MIT + file LICENSE
Converting rownames to a column
metrics_data <- setDT(data.frame(metrics_data), keep.rownames = TRUE)[]
metrics_data <- data.frame(metrics_data)
colnames(metrics_data) <- c("Metrics", "Description")
head(metrics_data)
## Metrics
## 1 Name
## 2 Version
## 3 Title
## 4 Description
## 5 Release Date
## 6 License
## Description
## 1 dplyr
## 2 0.7.3
## 3 A Grammar of Data Manipulation
## 4 A fast, consistent tool for working with data frame like objects,\nboth in memory and out of memory.
## 5 2017-09-09T14:04:29.000Z
## 6 MIT + file LICENSE