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

return value of demeanlist inconsistent for argument na.rm #50

Open
tappek opened this issue Aug 1, 2021 · 0 comments
Open

return value of demeanlist inconsistent for argument na.rm #50

tappek opened this issue Aug 1, 2021 · 0 comments

Comments

@tappek
Copy link

tappek commented Aug 1, 2021

The return value of demeanlist for matrix input is inconsistent when argument na.rm is flipped, see the example below.

For matrix inputs for the first argument, the return value is specified to be a matrix in the documentation (maybe other allowed inputs are treated inconsistently for na.rm (I did not check)).

m <- matrix(1:10, ncol = 2)
fl <- list(factor(c(1,1,2,2,2)))

res1 <- lfe::demeanlist(m, fl = fl, na.rm = FALSE)
res2 <- lfe::demeanlist(m, fl = fl, na.rm = TRUE)

class(res1) # c("matrix", "array")
class(res2) # c("list")

res22 <- res2[[1]]
identical(res1, res22) # TRUE
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

No branches or pull requests

1 participant