psmadness
psmadness

Reputation: 54

How to join two csv files in R and match the data from both tables?

I have two csv files

csv 1 has this data This is the data of csv 1

and csv 2 has this as its data Data of csv 2

I want to add the episode review column from csv 2 to csv 1 with the correct episode name. How could I get this done? Any help is appreciated

EDIT: This is the code that got it work

library(tidyverse)
library(rvest)
library(dplyr)

df1 = read.csv('NewEpisodes.csv', head = T)
df2 = read.csv('episodesReview.csv', head = T, )


dfLeft = df1 %>% left_join(df2, by=c("Episode.Name", "Show.Name"))

Upvotes: 0

Views: 903

Answers (1)

aaaaa
aaaaa

Reputation: 183

try this:

final_csv = merge(csv_1, csv_2, by = c("Show.Name", "Episode.Name"))

Upvotes: 1

Related Questions