Skip to content

Lab 6 - Error with Predict #23

@AprilPeck

Description

@AprilPeck

@Dselby86
I am trying to do question 3d using the Predict function:

data2 <- with(data, 
              data.frame(Democrats = mean(data$Democrats),
                         Evangelics = mean(data$Evangelics),
                         Catholics = mean(data$Catholics),
                         Media = quantile(data$Media, .95),
                         Merck = mean(data$Merck)))

data2$Adopt_prob <- predict(log, newdata = data2, type = "response")

But keep getting the following error:

Error in `$<-.data.frame`(`*tmp*`, Adopt_prob, value = c(`1` = 0.411174458260132, : replacement has 49 rows, data has 1

My data2 data frame looks good, but it seems like the predict function is trying to return too many rows.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions