I'm trying to reproduce the pandas (Python) explode method using R.
This is the data I have:
d = {"SN":[1,2],"Age":[21,15],"Name":["John;Luis","Dora"]}
df = pd.DataFrame(d)
df
From there I use split the names separated by ";" and use the explode method
df["Name"] = df["Name"].apply(lambda x: x.split(";"))
df.explode("Name")
The result I get is:
Now I'm trying to do the same using R. I have this part of the code, that accounts for the first step
df <- data.frame("SN" = 1:2, "Age" = c(21,15), "Name" = c("John;Luis","Dora"))
df$Name <- as.character(df$Name)
df = df %>%
mutate(Name = strsplit(Name,split=';', fixed=TRUE) )
But I'm not finding the equivalent to .explode()