PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, October 29, 2022

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

 October 29, 2022     csv, left-join, merge, r     No comments   

Issue

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"))

Solution

try this:

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


Answered By - aaaaa
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing