Skip to content
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

tex.catwitherror does not work well with vectors #253

Open
kostrzewa opened this issue Feb 20, 2020 · 5 comments · May be fixed by #303
Open

tex.catwitherror does not work well with vectors #253

kostrzewa opened this issue Feb 20, 2020 · 5 comments · May be fixed by #303

Comments

@kostrzewa
Copy link
Member

There should probably be some internal loops, such that vector-valued quantities can be dealt with. At present, this fails because the conditionals don't play nice with vectors of x and dx.

@urbach
Copy link
Member

urbach commented Feb 20, 2020 via email

@kostrzewa
Copy link
Member Author

well, it can be used with apply...!

That's true, but it cannot be used with dplyr::mutate like so:

data <- data.frame(val = [...], err = [...])
data <- dplyr::mutate(data, tex = tex.catwitherror(x = val, dx = err))

which is a really handy function for adding new columns to data frames based on existing columns.

@martin-ueding
Copy link
Contributor

I always just use mapply:

mutate(tex = mapply(tex.catwitherror, val, err))

@martin-ueding
Copy link
Contributor

It would be trivial to have a the current non-vectorized version as tex.catwitherror.scalar and then have a new tex.catwitherror which just calles the implementation with mapply. The problem is that currently it is allowed to pass value and error as a two-element vector as the first argument. This would become inconsistent then.

@urbach
Copy link
Member

urbach commented Feb 22, 2020 via email

@martin-ueding martin-ueding linked a pull request Aug 21, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants