We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This has come up quite frequently on SO. Here is one example.
Conceptually, tstrsplit() is just transpose(strsplit(...), fill=.) where transpose() is implemented in #1025.
tstrsplit()
transpose(strsplit(...), fill=.)
transpose()
require(data.table) dt <- data.table(category.tag=c("toys/David", "toys/David", "toys/James", "toys", "toys", "toys/James"), transaction=1:6) # category.tag transaction #1: toys/David 1 #2: toys/David 2 #3: toys/James 3 #4: toys 4 #5: toys 5 #6: toys/James 6
dt[, c("category", "tag") := tstrsplit(category.tag, "/", fixed=TRUE)] # category.tag transaction category tag #1: toys/David 1 toys David #2: toys/David 2 toys David #3: toys/James 3 toys James #4: toys 4 toys NA #5: toys 5 toys NA #6: toys/James 6 toys James
Additionally we can also pass a fill = argument to tstrsplit.
fill =
tstrsplit
The text was updated successfully, but these errors were encountered:
d5e49fb
Updated this and this SO posts.
Sorry, something went wrong.
arunsrinivasan
No branches or pull requests
This has come up quite frequently on SO. Here is one example.
Conceptually,
tstrsplit()
is justtranspose(strsplit(...), fill=.)
wheretranspose()
is implemented in #1025.Additionally we can also pass a
fill =
argument totstrsplit
.The text was updated successfully, but these errors were encountered: