New issue
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
Option to add colnames to new columns #58
Comments
Thanks @adomingues for the comment. I've thought about this in the past. It shouldn't be too difficult to implement, so I'll look into it again. Here are a couple of reasons I didn't implement it the first time around:
Any thoughts on those? |
Thanks for considering this @mrdwab. I was think about implementation, after posting and my very näive thought was to operate on the cSplit2 <- function(indt, splitCols, newNames, ...){
split <- cSplit(to_split, "Sample", sep="_")
newcols <- grep(paste(splitCols, collapse="|"), colnames(split))
colnames(split)[newcols] <- newNames
return(split)
}
cSplit2(to_split, splitCols = "Sample", sep="_", newNames = c("Background", "Allele", "Replicate", "Treatment")) This is of course of the opposite of what you suggested :) but I wonder it would be a good starting point. |
@adomingues, Here's a POC
So, a possible final implementation might look like:
Alternatively, the entire API can be revisited such that, depending on the input, the function behaves differently:
Let me think about it some more, but I'm open to other ideas as well as I'm currently planning a V2 release of the package later this year. |
This pretty much solves it, at least for me. Looking forward to V2. |
first of all thank you so much for this package! It is part of my routine analysis for some time now. I would just like to suggest a convenience option to skip column renaming after splitting. Example:
The new col names are not very informative, so I usually rename them in an extra step:
This is fine, but I wonder if it would possible to skip that extra step with
cSplit(to_split, "Sample", sep="_"), new_names=c("Background", "Allele", "Replicate", "Treatment")
Cheers.
The text was updated successfully, but these errors were encountered: