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

Piping data into pfr() breaks, but only sometimes #103

Open
jeff-goldsmith opened this issue Mar 15, 2023 · 0 comments
Open

Piping data into pfr() breaks, but only sometimes #103

jeff-goldsmith opened this issue Mar 15, 2023 · 0 comments
Labels

Comments

@jeff-goldsmith
Copy link
Member

In the example below, providing the data argument in the function call works with and without a scalar predictor (with a functional predictor in both cases). But piping a dataset in and using the . placeholder only works when there is no scalar predictor.

Any thoughts on why this might be the case?

Probably not critical at this juncture, since you can fit the model easily -- but might be nice to address.

library(refund)
library(tidyverse)

data(DTI)
DTI1 <- DTI[DTI$visit==1 & complete.cases(DTI),]

## WORKS: 

# functional predictor only
fit.lf <- 
  pfr(pasat ~ lf(cca, k=30, bs="ps"), data = DTI1)

# functional predictor only using pipes
fit.lf <- 
  DTI1 %>% 
  pfr(pasat ~ lf(cca, k=30, bs="ps"), data = .)

# functional and scalar predictor
fit.lf <- 
  pfr(pasat ~ case + lf(cca, k=30, bs="ps"), data = DTI1)

## BREAKS:

# functional and scalar predictor
fit.lf <- 
  DTI1 %>% 
  pfr(pasat ~ case + lf(cca, k=30, bs="ps"), data = .)
#> Error in eval(call$data): object '.' not found

Created on 2023-03-15 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant