I have 4 datasets and for analysis, we need to merge them into one
How to do it ?
Also I have second dataset Q2,whose columns are not in sync as per the other dataset,How to rename it
Also if i am trying to rename ,it is shwoing errors
library(dplyr)
Q2 <- Q2 %>% rename(V1= trip_id, V2=start_time, V3=end_time, V4=bike_id, V5=trip_duration,V6=from_station_id, V7=from_station_name, V8=to_station_id, V9=to_station_name, V10=user_type, V11=gender, V12=birth_year)
Error in UseMethod("rename") :
ERROR
no applicable method for 'rename' applied to an object of class "list"
You can learn about joining relational data here : 13 Relational data | R for Data Science (had.co.nz)
Otherwise; we would need more info to advise you.
about your rename issue; its clear from the error that Q2 is a mere list, and not one that is a data.frame which is what rename is designed to operate on.
Here is a link to our reprex guide for if you want to provide examples of your start data.
A minimal reproducible example consists of the following items:
A minimal dataset, necessary to reproduce the issue
The minimal runnable code necessary to reproduce the issue, which can be run
on the given dataset, and including the necessary information on the used packages.
Let's quickly go over each one of these with examples:
Minimal Dataset (Sample Data)
You need to provide a data frame that is small enough to be (reasonably) pasted on a post, but big enough to reproduce your issue.
Let's say, as an example, that you are working with the iris data frame
head(iris)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.…
1 Like
This book have a good examples.
Try to identify the common variables or id for merge this data set.
system
Closed
February 2, 2023, 2:08pm
4
This topic was automatically closed 42 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.