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
From Slack, I was looking for a good way to replicate something like
inds = (alldata.year .<= 1993) .& (alldata.ishead .== true) alldata.labor_inc_spouse[inds] .= alldata.labor_inc_pre_spouse[inds]
in one line. In Stata this would be replace labor_inc_spouse = labor_inc_pre_spouse if year <= 1993 & ishead == true
replace labor_inc_spouse = labor_inc_pre_spouse if year <= 1993 & ishead == true
@bkamins suggested
alldata.labor_inc_spouse .= ifelse.((alldata.year .<= 1993) .& (alldata.ishead .== true), alldata.labor_inc_pre_spouse, alldata.labor_inc_spouse)
which operates in place and is efficient.
It could be nice to have a macro version of that like
@replace(df, :labor_inc_spouse = :labor_inc_pre_spouse if :year .<= 1993 & :ishead .== true)
The text was updated successfully, but these errors were encountered:
I'm sorry I missed this issue when it came up over a year ago.
This is definitely something that needs serious consideration both here and at DataFramesMeta. here is discussion in DataFrames about the same issue.
I think a @ByRow macro will help with this, but making it work with missings will be tough.
@ByRow
missing
Marking this as 1.X since its a new feature that can be added without breaking.
Sorry, something went wrong.
No branches or pull requests
From Slack, I was looking for a good way to replicate something like
in one line. In Stata this would be
replace labor_inc_spouse = labor_inc_pre_spouse if year <= 1993 & ishead == true
@bkamins suggested
which operates in place and is efficient.
It could be nice to have a macro version of that like
The text was updated successfully, but these errors were encountered: