[R] Extract input and filter data using extracted value.

Sathiaraj S P sathiaraj_sp at yahoo.com
Tue Jan 24 11:26:20 CET 2017


Hi,

I raised this question @ stack overflow and got below partial answer. Hope this mailing list can help on rest to complete.

library(dplyr)
library(tidyr)

input <- "1.8 - versicolor"

temp <- data.frame(input = input) %>%

          tidyr::separate(input, c("Petal.Width", "Species"),sep = " - ", convert = TRUE)
filtered <- dplyr::filter(iris, iris$Petal.Width %in% temp$Petal.Width)

This work fine but my input is "A001 - Description1" and I get "Error: operations are possible only for numeric, logical or complex types". even I tried with convert as FALSE.

Any suggestion? Is there any alternative package for the solution?

Thanks



More information about the R-help mailing list