Displaying 4 results from an estimated 4 matches for "inscompany".
2011 Jun 09
1
Trying to make code more efficient
...;insurance"), prefix = c("cheap", "budget"),
prefix2 = c("low cost"), suffix = c("quote", "quotes"),
suffix2 = c("rate", "rates"), suffix3 = c("comparison"),
state = c(state), inscompany = c(inscompany), city=c(city),
cityst = c(cityst), agency=c(agency))
myone <- function(x, y) {
m1 <- do.call(paste, expand.grid(lst[[x]], lst[[y]]))
mydf <- data.frame(keyword=c(m1))
}
mytwo <- function(x, y, z){
m2 <- do.call(...
2011 Jun 09
1
Error: missing values where TRUE/FALSE needed
...ix, roots2)
d16 = myone(prefix2, roots2)
d17 = myone(roots, suffix)
d18 = myone(roots, suffix2)
d19 = myone(roots, suffix3)
d20 = myone(roots2, suffix)
d21 = myone(roots2, suffix2)
d22 = myone(roots2, suffix3)
d23 = myone(state, roots)
d24 = myone(city, roots)
d25 = myone(cityst, roots)
d26 = myone(inscompany, roots)
d27 = myone(state, roots2)
d28 = myone(city, roots2)
d29 = myone(cityst, roots2)
d30 = myone(inscompany, roots2)
d31 = mytwo(state, roots, suffix)
d32 = mytwo(city, roots, suffix)
d33 = mytwo(cityst, roots, suffix)
d34 = mytwo(inscompany, roots, suffix)
d35 = mytwo(state, roots, suffix2)
d3...
2011 Jun 09
2
Problem with a if statement inside a function
...t;NC", "ND", "OH",
"OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX",
"UT", "VT", "VA", "WA", "WV", "WI", "WY")
inscompany <- c("21st Century", "AAA", "Alliance United", "Allied",
"American Automobile Association", "AARP", "AIG",
"American International Group", "Allstate", "All State",
"All-state",...
2011 Jun 14
1
Invalid Regular Expression
...Alaska 1 0 0
he lives in 66062 0 0 1
So basically, I'm generating a 1 if a phrase contains a state, city, or zip
code, and 0 if it doesn't.
Using the stringr package, I developed the following code:
library(stringr)
inscompany_match <- str_c(inscompany, collapse = "|")
state_match <- str_c(state, collapse = "|")
city_match <- str_c(city, collapse = "|")
agency_match <- str_c(agency, collapse = "|")
zipcode_match <- str_c(zipcode, collapse = "|")
mydf$i...