-
Notifications
You must be signed in to change notification settings - Fork 0
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
Function to Mutate a subset of dataset, and reattach it to the dataset #27
Comments
I believe I understand what you are asking but if you could rephrase your inquiry with a sample dataset, it would be more helpful. |
To make it easier for you to assess, i put together a rough draft of the function and updated this repository. Here is an example, I want to subset to "mpg == 21.0 & cyl == 6", then mutate various columns within that subset while leaving the others intactwith base R, this is how I would approach itdt[dt$mpg == 21.0 & dt$cyl == 6,]$cyl = 1000 with the new function, this how I will do itmutate_filter(dt,mpg == 21.0 & cyl == 6, cyl=1000,hp=2000,vs=hp*2) |
The proposed function you have described does not exist, at least in the way you have described it, in R. Given the additional information you have provided, I have crafted what I believe is a function that meets the requirements you have laid out. FUNCTION NAME: TOTAL NUMBER OF FUNCTION ARGUMENTS: ARGUMENT NAMES:
ARGUMENT SUMMARY DESCRIPTION:
OPTIONALITY: FUNCTION STRUCTURE:
FUNCTION TESTING STATUS: If the function does not work as presented, especially consistent with the examples provided, please reach out and I will send the function syntax again. It is possible that the conversion from the R application to this medium did not capture the code syntax correctly. FUNCTIONAL UTILITY: One way to improve the utility of the mutate_filter function would be to replace one of the mutcol arguments with an argument that can control the removal of contiguous or non-contiguous variables from the data frame object in the mutated output. CODE EXAMPLES:
|
Thanks Brice. Actually, I don't think we need the secondary arguments since one can easily combine such as "mpg == 21 & cyc == <3" |
Does the proposed function I provided meet the requirements you laid out?
…________________________________
From: Obi Obianom ***@***.***>
Sent: Friday, June 21, 2024 7:48 PM
To: oobianom/quickcode ***@***.***>
Cc: brichard1638 ***@***.***>; Comment ***@***.***>
Subject: Re: [oobianom/quickcode] Function to Mutate a subset of dataset, and reattach it to the dataset (Issue #27)
Thanks Brice. Actually, I don't think we need the secondary arguments since one can easily combine such as "mpg == 21 & cyc == <3"
—
Reply to this email directly, view it on GitHub<#27 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ASLI5UN6PXK5NOM2SVIVWMLZIS3VNAVCNFSM6AAAAABJJHUJEWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBTGU4DONBRGM>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Based on your latest feedback, I've re-constructed the mutate_filter function in the following ways:
NEW FUNCTION STRUCTURE:
It is believed that this version of the mutate_filter function possesses a much higher value proposition than its predecessor. As a result, this modified function should be the one selected for inclusion in the quickcode package. FUNCTION TESTING STATUS: ADDITIONAL NOTES:
CODE EXAMPLES:
CONCLUSION |
Thanks Brice! |
When are you planning on publishing the next version of quickcode?
…________________________________
From: Obi Obianom ***@***.***>
Sent: Saturday, June 22, 2024 9:28 PM
To: oobianom/quickcode ***@***.***>
Cc: brichard1638 ***@***.***>; Comment ***@***.***>
Subject: Re: [oobianom/quickcode] Function to Mutate a subset of dataset, and reattach it to the dataset (Issue #27)
Thanks Brice!
—
Reply to this email directly, view it on GitHub<#27 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ASLI5UMM64DCODJCPFLN6R3ZIYQERAVCNFSM6AAAAABJJHUJEWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBUGMYTAMZWGU>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Hi Brice, does such a function already exist?
Basically, with dplyr, I can filter and then do all downstream processes like group_by mutate and so on. But there I need that filtered portion to remain in the entire dataset after the manipulation of that subset.
Let me know if you understand. Else, I can rephrase.
The text was updated successfully, but these errors were encountered: