# R + Py

In the word of R vs Python fights, This is a simple (could be called, naive as well) attempt to show how we can combine the power of Python with R and create a new superpower. Like this one, If you have watched The Incredibles before!

This dataset contains a bunch of tweet that came with this tag #JustDoIt after Nike released the ad campaign with Colin Kaepernick that turned controversial.

# Superstar - Reticulate

The superstar who’s making this possible is the R package reticulate by RStudio.

# The R Code

#loading required R libraries
library(tidyverse)
library(ggthemes)
library(knitr)
py$pos_df %>% count(pos) %>% ggplot() + geom_bar(aes(pos,n), stat = "identity") + coord_flip() + theme_minimal() + labs(title = "POS Tagging", subtitle = "NLP using Python space - Graphics using R ggplot2") # Now, Again The Python Code ent_df = pd.DataFrame(columns = ["text","label"]) for ent in doc.ents: df1 = pd.DataFrame({"text" : ent.text, "label" : ent.label_}, index = ) #print(token.text, token.pos_) #print(df1) ent_df = pd.concat([ent_df,df1]) # One Final Time, The R Code py$ent_df %>%
count(label) %>%
ggplot() + geom_bar(aes(label,n), stat = "identity") +
coord_flip() +
#theme_solarized() +
theme_fivethirtyeight() +
labs(title = "Entity Recognition",
subtitle = "NLP using Python space - Graphics using R ggplot2") ### Summary

Thus, In this post we learnt how to combine the best of R and Python - in this case - R for Data Analysis and Data Visualization - Python for Natural Languge Processing with Spacy.

If you liked this, Please subscribe to my Language-agnostic Data Science Newsletter and also share it with your friends!