# issue

I have dynamically included the results of a regression into a dataframe - so far so good.

I can use predict from the dataframe so regressions have worked

I now want to use predict as part of a pipeline.

For each of the four lines in dataAndModel below I want to find the predicted value from the associated model and the single data point x on each line.

There are two issues:

- passing the regression equation so it is recognised in the pipeline by predict
- passing a single datapoint instead of a dataframe

I am seeking an output looking like

x forecastedValueofXforGivenModel

3 13

4 14

5 15

6 16

Thanks in advance for your comments

```
library(dplyr)
library(stats)
theData <- data.frame(type=c(1,1,2,2),x=c(1,2,3,4), y=c(11,12,13,14))
regressions <- theData %>%
group_by(type) %>%
do(myModel=lm(y ~ x, data=.))
regressions #1 <S3: lm> and 2 <S3: lm>
evaluate <- data.frame(type=c(1,1,2,2), x=c(3,4,5,6))
fakeX <- data.frame(x=c(3,4,5,6))
dataAndModel <- evaluate %>%
merge(x=.,y=regressions)
{ # works so regression is working
predict(dataAndModel[[1,"myModel"]],fakeX)
}
# now i want to use predict as part of a pipe
dataAndModel %>% # does not work - given x is not a dataframe not expected to work
mutate(yEst = predict(myModel,x))
dataAndModel %>% # does not work
mutate(yEst = predict(myModel,fakeX))
```