I have the following input.
x <- c("a","b","c")
y <- c(1,2,3)
z <- c("M","N")
df1 = data.frame(x,y)
df2 = data.frame(df1,z)
Output:
Error in data.frame(df1, z) : arguments imply differing number of rows: 3, 2
I want the final dataframe to look like this:
x y z
a 1 M
b 2 M
c 3 M
a 1 N
b 2 N
c 3 N
Thank you for your help