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

Issues with tibbles and backCalc() #34

Closed
droglenc opened this issue Dec 21, 2018 · 3 comments
Closed

Issues with tibbles and backCalc() #34

droglenc opened this issue Dec 21, 2018 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@droglenc
Copy link
Contributor

backCalc() fails when the data is a tibble because the following lines return a one-column data.frame on tibbles but a vector on regular data.frames. This can be corrected by converting the tibble to a data.frame with as.data.frame() but I need to find a more robust answer. Another possible solution, but I need to research this more, is to add drop=TRUE to the following lines in backCalc().

regLcap <- regdat[,rlang::quo_name(rlang::enquo(lencap))]
Lcap <- dat[,rlang::quo_name(rlang::enquo(lencap))]
@droglenc droglenc added the bug Something isn't working label Dec 21, 2018
@droglenc droglenc self-assigned this Dec 21, 2018
@droglenc
Copy link
Contributor Author

droglenc commented Apr 13, 2019

See this ...

library(tibble)

( dft <- tibble(id=1:10,x=rnorm(10)) )
( df <- as.data.frame(dft) )

dft[,"x"]
df[,"x"]
df[,"x",drop=FALSE]
dft[,"x",drop=FALSE]
df[,"x",drop=TRUE]
dft[,"x",drop=TRUE]

@droglenc
Copy link
Contributor Author

Use this is a test (seems to work properly for versions >0.2.0

data(SMBassWB2,package="RFishBC")
data(SMBassWB1,package="RFishBC")

smb1 <- inner_join(SMBassWB1,SMBassWB2,by="id") %>%
  arrange(id)
smb2 <- as_tibble(smb1)
str(smb1)
str(smb2)

smb1_FL <- backCalc(smb1,lencap,BCM="FRALE",inFormat="wide",digits=0)
smb2_FL <- backCalc(smb2,lencap,BCM="FRALE",inFormat="wide",digits=0)
str(smb1_FL)
str(smb2_FL)

@droglenc
Copy link
Contributor Author

Is fixed in versions >0.2.0

droglenc added a commit that referenced this issue Apr 13, 2019
@droglenc droglenc mentioned this issue Apr 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant