Use stringr::str_split_fixed
library(stringr)
str_split_fixed(before$type, "_and_", 2)
More Related Contents:
- Split comma-separated strings in a column into separate rows
- How to split a data frame?
- Reshaping data.frame from wide to long format
- How to sum a variable by group
- How do I make a list of data frames?
- Aggregate / summarize multiple variables per group (e.g. sum, mean)
- Sort (order) data frame rows by multiple columns
- Calculate the mean by group
- Select the row with the maximum value in each group
- Filter data.frame rows by a logical condition
- Remove rows with all or some NAs (missing values) in data.frame
- Subset data frame based on number of rows per group
- Pass a data.frame column name to a function
- Drop data frame columns by name
- Sample random rows in dataframe
- Calculate the mean of every 13 rows in data frame
- Extracting specific columns from a data frame
- Subset / filter rows in a data frame based on a condition in a column
- How does one reorder columns in a data frame?
- Rename multiple columns by names
- Combine two or more columns in a dataframe into a new column with a new name
- Test if characters are in a string
- Split dataframe into multiple output files
- Deleting reversed duplicates with R
- Split data.frame by value
- Convert a dataframe to a vector (by rows)
- Splitting a large data frame into smaller segments
- R split string by symbol
- Split a string every 5 characters
- Split a string column into several dummy variables