How to resolve the algorithm Rosetta Code/Rank languages by popularity step by step in the R programming language

Published on 12 May 2024 09:40 PM
#R

How to resolve the algorithm Rosetta Code/Rank languages by popularity step by step in the R programming language

Table of Contents

Problem Statement

Sort the most popular computer programming languages based in number of members in Rosetta Code categories. Sample output on 02 August 2022 at 09:50 +02

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Rosetta Code/Rank languages by popularity step by step in the R programming language

Source code in the r programming language

library(rvest)
library(dplyr)
options(stringsAsFactors=FALSE)

# getting the required table from the rosetta website
langUrl <- "https://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity/Full_list"
langs <- read_html(langUrl) %>%
  html_nodes(xpath='/html/body/div/div/div[1]/div[3]/main/div[2]/div[3]/div[1]/table') %>%
  html_table() %>% 
  data.frame() %>%
  select(c("Rank","TaskEntries","Language"))


 # changing the columns to required format
langs$Rank = paste("Rank: ",langs$Rank)
langs$TaskEntries = paste0("(", format(langs$TaskEntries, big.mark = ",")
                           ," entries", ")")

names(langs) <- NULL

langs[1:10,]

  

You may also check:How to resolve the algorithm Stack step by step in the C programming language
You may also check:How to resolve the algorithm 24 game/Solve step by step in the REXX programming language
You may also check:How to resolve the algorithm Sorting algorithms/Bead sort step by step in the Raku programming language
You may also check:How to resolve the algorithm Look-and-say sequence step by step in the PL/M programming language
You may also check:How to resolve the algorithm Find palindromic numbers in both binary and ternary bases step by step in the jq programming language