Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

R Error All select() inputs must resolve to integer column positions

jbh1128d1
10 - Fireball

Hello.  So the following r code works in R-Studio but not in Alteryx.  I have put in the full code (that I've tested to this point).  The code works until you get to the bolded/italicized/underlined text.  After the segmented model is ran, I then run the underlined/bolded code fine in Rstudio but it errors out in Alteryx stating:

 

"Error: All select() inputs must resolvel to integer column positions"

 

# Load the packages
package_name <- c("segmented", "dplyr", "ggplot2", "stringr", "broom")

altx.repo <- getOption("repos")
altx.repo["CRAN"] <- "https://cran.rstudio.com/"
options(repos = altx.repo)

if(package_name %in% rownames(installed.packages())==FALSE) {
install.packages(package_name)
}

lapply(package_name, library, character.only = TRUE)

# Read in the data from Alteryx into R
the_data <- read.Alteryx("#1", mode="data.frame")

write.Alteryx(the_data, 1)

#do glm
set.seed(1)
piecewise2 <- glm(freq ~ credit_tier_bucket + rba_bucket, family = quasipoisson(link="log"), data = the_data)
#do segmented
piecewise_seg2 <- segmented(piecewise2, seg.Z = ~ credit_tier_bucket + rba_bucket,
psi = list(credit_tier_bucket= c(3), rba_bucket = c(4750, 25750)))


#pull out slopes from segmented model
slopes2 <- bind_rows(lapply(slope(piecewise_seg2), tidy), .id = "variable") %>%
mutate(segment = str_extract(.rownames, "[0-9]+$")) %>%
select(variable, segment, slope = "Est.", error = "St.Err.")

 

 

Any ideas?

2 REPLIES 2
JohnJPS
15 - Aurora

Can you add magrittr to your list of required packages and see if that helps?

jbh1128d1
10 - Fireball

Thanks @JohnJPS.  It was actually the lack of 'tibble' package not loaded.  I forgot to update this one.  Thanks for replying.

Labels