Using a simple string like this:
a <- "l_Gf43qCW2r&auty=in_out"
I can keep only the first part using this:
b <- strsplit(a, "&auty=")[[1]][1]
I would like to make the same for a whole column from a dataframe. I tried this:
n = 1
for (i in 1:nrow(df)) {
c <- strsplit(df$col1[n], "&auty=")[[1]][1]
n = n + 1
}
but I receive this error:
Error in strsplit(df$col1[n], "&auty=") : non-character argument
Is there any different way for dataframes to make it?