Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
df1 <- data.frame(a=rep(1:3, each=4), b=round(runif(12, 10, 20)))
df2 <- data.frame(a=0:1, c=10:11)
# You have two dataframe df1 and df2 from the code below. df1 and df2 have column a in common.
# The challenge for this video is as follows:
# 1. From df1, remove the rows that are present in df2, based on the common column a.
# 2. Create another dataframe df3 that contains all the rows and columns from both datasets.
# 3. In df2, rename column a as `apple` in df2 and create a new dataframe named 'df4' that
# contains only the common rows in df1 and df2.
# 4. In df1, for each unique value of column a, compute the mean, first, second, last
# and second last value of column 'b' in separate columns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.