Hi, it is working now using just the most necessary pkgs. Evidently when there are so few rows (clus1=53) the map does not cooperate, I get the plot but no map image? As I increase records the map begins to appear as it did for Radius1-8 routines Thank you for your time and trouble my friends. WHP Proprietary -----Original Message----- From: Poling, William Sent: Thursday, May 14, 2020 6:46 AM To: Jim Lemon <drjimlemon at gmail.com> Cc: r-help at r-project.org; Mark Fowler <gmark.fowler at outlook.com> Subject: RE: [EXTERNAL] Re: [R] Help with map() Hi, I ran this which is partially successful. I got long & lat (x&y) with red plot values however, no map behind it? Not sure what I might be missing now in terms of pkgs I suppose? #Just use the basic pkgs library(magrittr)#for %>% function library(plotrix) library(maps) library(dplyr)#For filter() str(individual_dets_sf_3X) str(radius3) str(clus1) #rm(clus1) clus1 <- individual_dets_sf_3X %>% dplyr::select(MBR_SUBSCRIBERID,state,city,clusters,Latitude,Longitude,distances_Mi) %>% #Notice now that these are capitalized <--"L" filter(clusters == 1) str(clus1) clus1 <- as.data.frame(clus1) geomat<-makeDensityMatrix(clus1[,c("Latitude","Longitude")], xlim=range(clus1$Longitude),ylim=range(clus1$Latitude)) # Range of density (>0) - 1.292155 3.89646 latlim<-range(clus1$Latitude) lonlim<-range(clus1$Longitude) map("world",xlim=lonlim,ylim=latlim) axis(1) axis(2) densityGrid(geomat,range.cex=c(1,5),xlim=lonlim,ylim=latlim, red=c(0.5,1),green=0,blue=0,pch=15) title("Member Geo Density Plot For Cluster1") Proprietary -----Original Message----- From: Poling, William Sent: Thursday, May 14, 2020 6:29 AM To: Jim Lemon <drjimlemon at gmail.com> Cc: r-help at r-project.org; Mark Fowler <gmark.fowler at outlook.com> Subject: RE: [EXTERNAL] Re: [R] Help with map() Hi Jim, and Mark, thank you for your response. 1. I have restarted R 2. I have only initiated library(magrittr)#for %>% function & library(plotrix), no other libraries thinking that another may be overwriting something. 3. I have checked the str() str(radius3) 'data.frame': 1990 obs. of 6 variables: $ MBR_SUBSCRIBERID: Factor w/ 2352 levels "101040199600",..: 590 908 976 509 1674 690 1336 726 1702 2331 ... $ state : Factor w/ 41 levels "AL","AR","AZ",..: 32 10 25 11 9 32 13 12 12 17 ... $ city : Factor w/ 1337 levels "ABBOTTSTOWN",..: 932 156 230 698 965 1330 515 1127 1304 1316 ... $ Latitude : num 40.4 31.2 40.8 42.1 26.8 ... $ Longitude : num -79.9 -81.5 -74 -91.6 -82.1 ... $ distances_Mi : num 310.3 769.9 16.1 920.4 1057.6 ... str(clus1) tibble [53 x 7] (S3: tbl_df/tbl/data.frame) $ MBR_SUBSCRIBERID: Factor w/ 2352 levels "101040199600",..: 86 2111 995 899 953 924 769 92 790 1748 ... $ state : Factor w/ 41 levels "AL","AR","AZ",..: 31 39 4 39 39 39 39 31 39 39 ... $ city : Factor w/ 1337 levels "ABBOTTSTOWN",..: 727 85 455 1018 1203 604 1169 727 984 295 ... $ clusters : num [1:53] 1 1 1 1 1 1 1 1 1 1 ... $ Latitude : num [1:53] 42.4 47.6 39.2 46.9 48 ... $ Longitude : num [1:53] -123 -122 -121 -123 -122 ... $ distances_Mi : num [1:53] 2499 2406 2472 2430 2408 ... 4. I change clus1 to DF 'data.frame': 53 obs. of 7 variables: $ MBR_SUBSCRIBERID: Factor w/ 2352 levels "101040199600",..: 86 2111 995 899 953 924 769 92 790 1748 ... $ state : Factor w/ 41 levels "AL","AR","AZ",..: 31 39 4 39 39 39 39 31 39 39 ... $ city : Factor w/ 1337 levels "ABBOTTSTOWN",..: 727 85 455 1018 1203 604 1169 727 984 295 ... $ clusters : num 1 1 1 1 1 1 1 1 1 1 ... $ Latitude : num 42.4 47.6 39.2 46.9 48 ... $ Longitude : num -123 -122 -121 -123 -122 ... $ distances_Mi : num 2499 2406 2472 2430 2408 ... Then try again, no luck? Weird? Thanks WHP Proprietary -----Original Message----- From: Jim Lemon <drjimlemon at gmail.com> Sent: Thursday, May 14, 2020 5:44 AM To: Poling, William <PolingW at aetna.com> Cc: r-help at r-project.org Subject: [EXTERNAL] Re: [R] Help with map() **** External Email - Use Caution **** Hi Bill, Have you compared str(radius3) to str(clus1)? It may be quite different. Jim On Thu, May 14, 2020 at 8:24 PM Poling, William via R-help <r-help at r-project.org> wrote:> > #RStudio Version Version 1.2.1335 > sessionInfo() > # R version 4.0.0 Patched (2020-05-03 r78349) > #Platform: x86_64-w64-mingw32/x64 (64-bit) #Running under: Windows 10 > x64 (build 17763) > > Good morning. > > I ran routines like this one yesterday with no errors. > > #Radius3---- > str(radius3) > > radius3 <- individual_dets_sf_3X %>% > > dplyr::select(MBR_SUBSCRIBERID,state,city,Latitude,Longitude,distances_Mi) %>% > filter(distances_Mi <= 1200) > > str(radius3) > > geomat<-makeDensityMatrix(radius3[,c("Latitude","Longitude")], > > xlim=range(radius3$Longitude),ylim=range(radius3$Latitude)) > > latlim<-range(radius3$Latitude) > lonlim<-range(radius3$Longitude) > > <- map("world",xlim=lonlim,ylim=latlim) > axis(1) > axis(2) > densityGrid(geomat,range.cex=c(1,5),xlim=lonlim,ylim=latlim, > red=c(0.5,1),green=0,blue=0,pch=15) > title("Member Geo Density Plot For Radius3") > > > This morning I am trying slightly new routine and receiving this error > > clus1 <- individual_dets_sf_3X %>% > > dplyr::select(MBR_SUBSCRIBERID,state,city,clusters,Latitude,Longitude,distances_Mi) %>% > filter(clusters == 1) > > geomat<-makeDensityMatrix(clus1[,c("Latitude","Longitude")], > > xlim=range(clus1$Longitude),ylim=range(clus1$Latitude)) > > latlim<-range(clus1$Latitude) > lonlim<-range(clus1$Longitude) > > map("world",xlim=lonlim,ylim=latlim) > axis(1) > axis(2) > densityGrid(geomat,range.cex=c(1,5),xlim=lonlim,ylim=latlim, > red=c(0.5,1),green=0,blue=0,pch=15) > title("Member Geo Density Plot For Cluster1") > > > geomat<-makeDensityMatrix(clus1[,c("Latitude","Longitude")], > + > + xlim=range(clus1$Longitude),ylim=range(clus1$Latitude)) > > > latlim<-range(clus1$Latitude) > > lonlim<-range(clus1$Longitude) > > > > map("world",xlim=lonlim,ylim=latlim) > Error in .C(C_map_type, as.character(mapbase), integer(1)) : > Incorrect number of arguments (2), expecting 0 for '' > > axis(1) > Error in axis(1) : plot.new has not been called yet > > axis(2) > Error in axis(2) : plot.new has not been called yet > > densityGrid(geomat,range.cex=c(1,5),xlim=lonlim,ylim=latlim, > + red=c(0.5,1),green=0,blue=0,pch=15) > Error in plot.xy(xy.coords(x, y), type = type, ...) : > plot.new has not been called yet > > title("Member Geo Density Plot For Cluster1") > Error in title("Member Geo Density Plot For Cluster1") : > plot.new has not been called yet > > > It seems to error at the point of map("world",xlim=lonlim,ylim=latlim) > > I find a ref in stack overflow > https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com > _questions_45066628_cannot-2Drun-2Dmap-2Ddatastate&d=DwIBaQ&c=wluqKIiw > ffOpZ6k5sqMWMBOn0vyYnlulRJmmvOXCFpM&r=j7MrcIQm2xjHa8v-2mTpmTCtKvneM2Ex > lYvnUWbsByY&m=sRhKIDOv4AuwrfDBU9b2Rpj-VPfs0lcpkQqNBfVLSe4&s=sEjkBzlaFR > 7NhUDpUPGPp1nOkAxOlBbFNadLowcDbFw&e> and tried solutions but they do not seem to work? > > Here is a sample (MBR_SUBSCRIBERID(factor) is replaced with ID(integer) but of no consequence in my routine since not really used. > > I hope someone recognizes the problem. > > Thank you for any advice > > WHP > > > dput(sample) > structure(list(state = structure(c(2L, 22L, 10L, 12L, 6L, 22L, 11L, > 22L, 22L, 32L, 19L, 29L, 9L, 9L, 10L, 30L, 33L, 35L, 41L, 12L, 12L, > 36L, 4L, 9L, 8L, 39L, 36L, 36L, 41L, 28L, 12L, 28L, 28L, 12L, 11L, 2L, > 12L, 22L, 32L, 22L, 12L, 10L, 10L, 22L, 10L ), .Label = c("AL", "AR", > "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "IA", "IL", "IN", > "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO", "NC", "NE", > "NJ", "NM", "NV", "NY", "OH", "OK", "OR", "PA", "SC", "SD", "TN", > "TX", "UT", "VA", "WA", "WI", "WV" > ), class = "factor"), city = structure(c(838L, 1030L, 262L, 218L, > 166L, 973L, 339L, 451L, 660L, 358L, 281L, 1280L, 129L, 223L, 989L, > 721L, 550L, 731L, 1325L, 688L, 1184L, 281L, 759L, 1171L, 1305L, 587L, > 272L, 581L, 263L, 152L, 217L, 152L, 390L, 5L, 571L, 1006L, 1162L, > 939L, 170L, 1033L, 1002L, 586L, 586L, 192L, 586L ), .Label = > c("ABBOTTSTOWN", "ABILENE", "ACWORTH", "ADAMS", "ADDISON", "ADKINS", > "ALBANY", "ALBIA", "ALBUQUERQUE", "ALEXANDRIA", "ALFRED", "ALIQUIPPA", > "ALISO VIEJO", "ALLEN PARK", "ALLENTOWN", "ALPHA", "ALPHARETTA", > "ALPINE", "ALTOONA", "AMARILLO", "AMBLER", "AMBRIDGE", "AMHERST", > "AMITYVILLE", "ANAHIEM", "ANDERSON", "ANDOVER", "ANGIER", "ANGLETON", > "ANKENY", "ANN ARBOR", "ANZA", "APEX", "APOLLO", "ARCADIA", > "ARCHDALE", "ARDMORE", "ARGYLE", "ARKANSAS CITY", "ARLINGTON", > "ARNOLD", "ARTHUR", "ASHEBORO", "ASHEVILLE", "ASHLAND", "ASHLAND > CITY", "ASHTON", "ASTON", "ATHENS", "ATLANTA", "ATLANTIC BCH", > "AUBORN", "AUGUSTA", "AURORA", "AUSTELL", "AUSTIN", "AVENTURA", > "AVONDALE ESTATES", "BAKERSFIELD", "BALDWIN CITY", "BALDWIN PLACE", > "BALLWIN", "BANGOR", "BARBOURSVILLE", "BARNEGAT", "BARTLETT", > "BARTON", "BARTONVILLE", "BASSETT", "BATAVIA", "BATESBURG", "BATON > ROUGE", "BAXTER SPRINGS", "BAY CITY", "BAYONNE", "BAYSIDE", "BAYTOWN", > "BEAR", "BEAUMONT", "BEECH CREEK", "BEECHER CITY", "BELFAIR", "BELLE > VERNON", "BELLEAIR", "BELLEVUE", "BELLMAWR", "BELLMORE", "BELLWOOD", > "BELMAR", "BELMONT", "BELVIDERE", "BENNET", "BENTON", "BENTONVILLE", > "BERLIN", "BESSEMER CITY", "BETHANY", "BETHEL", "BETHEL PARK", > "BETHESDA", "BETHLEHEM", "BETTENDORF", "BIGLERVILLE", "BINGHAMTON", > "BIRDSBORO", "BIWABIK", "BLACK MOUNTAIN", "BLACKSBURG", "BLAINE", > "BLAIRSVILLE", "BLAKESLEE", "BLOOMFIELD", "BLUE BELL", "BLUE GRASS", > "BLUE POINT", "BLUE SPRINGS", "BOCA RATON", "BODFISH", "BOILING > SPRINGS", "BOLIVAR", "BON AQUA", "BONNER SPRINGS", "BONNEY LAKE", > "BOONEVILLE", "BOSSIER CITY", "BOUNTIFUL", "BOWLING GREEN", > "BOYERTOWN", "BOYNTON BEACH", "BRADENTON", "BRADENVILLE", > "BRANDAMORE", "BRANDON", "BRANFORD", "BRANSON", "BRASELTON", > "BREEZEWOOD", "BRENTON", "BRENTWOOD", "BREWSTER", "BRICK", > "BRIDGEPORT", "BRIDGETON", "BRIGHAM CITY", "BROADDUS", "BROCKPORT", > "BROGUE", "BROKEN ARROW", "BRONX", "BROOKFIELD", "BROOKHAVEN", > "BROOKLYN", "BROWNS MILLS", "BROWNSBURG", "BROWNSVILLE", "BRUNSWICK", > "BRYAN", "BUCKSPORT", "BUDD LAKE", "BUFFALO", "BULVERDE", > "BUNKERVILLE", "BURBANK", "BURFORD", "BURIEN", "BURLINGTON", "BURR > RIDGE", "BURTON", "BUSKIRK", "BUTLER", "BUXTON", "BYRON", "CALERA", > "CAMBRIDGE", "CAMP HILL", "CAMPBELL", "CANAAN", "CANAL WINCHESTER", > "CANASTOTA", "CANTON", "CARDIFF BY THE SEA", "CARL JUNCTION", > "CARLISLE", "CARLTON", "CAROL STREAM", "CARROLLTON", "CARSON CITY", > "CARTERSVILLE", "CARTHAGE", "CARY", "CASEYVILLE", "CASSVILLE", > "CASWELL", "CATO", "CEDAR RAPIDS", "CEDARBURG", "CEDARVILLE", "CENTER > POINT", "CENTERTON", "CENTRAL ISLIP", "CENTRAL POINT", "CHAGRIN > FALLS", "CHALFONT", "CHAPEL HILL", "CHAPIN", "CHARDON", "CHARITON", > "CHARLESTON", "CHARLOTTE", "CHEROKEE", "CHERRY HILL", "CHERRY VALLEY", > "CHESHIRE", "CHEST SPRINGS", "CHESTER", "CHESTERTON", "CHICAGO", > "CHILLICOTHE", "CHOCTAW", "CICERO", "CINCINNATI", "CLAY", > "CLEARWATER", "CLEARWATER BEACH", "CLEMMONS", "CLENDENIN", > "CLEVELAND", "CLEVELAND HTS", "CLEVES", "CLIFFSIDE PARK", "CLIFTON", > "CLIFTON PARK", "CLIFTON SPGS", "CLINTON", "COACHELLA", "COAL > TOWNSHIP", "COATESVILLE", "COLLEGE STATION", "COLLINSVILLE", > "COLONIA", "COLUMBIA", "COLUMBUS", "COMMERCE", "CONCORD", "CONCORD > TOWNSHIP", "CONNELLSVILLE", "CONROE", "CONWAY", "CONYERS", > "COOKEVILLE", "COON RAPIDS", "CORAOPOLIS", "CORDOVA", "CORNELIUS", > "CORNWALL", "CORONADO", "CORPUS CHRISTI", "CORRY", "COTTAGE HILLS", > "COTTLEVILLE", "COTTONWOOD", "COVINGTON", "COWEN", "CRANBERRY > TOWNSHIP", "CROWN POINT", "CUBA", "CUMBERLAND CENTER", "CUMBERLAND > FORESIDE", "CUMMING", "CUYAHOGA FLS", "CYPRESS", "DALLAS", > "DALLASTOWN", "DANBURY", "DANIA BCH", "DANVILLE", "DAVENPORT", > "DAVIE", "DAVIS JUNCTION", "DAWSON", "DAYTON", "DE SOTO", "DECATUR", > "DEFIANCE", "DEFOREST", "DELAVAN", "DELMAR", "DELRAY BEACH", > "DEMOTTE", "DENISON", "DENVER", "DEPTFORD", "DERBY", "DERRY", "DES > MOINES", "DETROIT", "DICKINSON", "DILLSBURG", "DITTMER", "DIXON", > "DONNA", "DOTHAN", "DOUGLAS", "DOUGLASVILLE", "DOVER", "DOYLESTOWN", > "DREXEL HILL", "DUBLIN", "DUCHESNE", "DULUTH", "DUNCAN", "DUNCANNON", > "DUNCANSVILLE", "DUNEDIN", "DUNNSVILLE", "DURHAM", "DUTTON", "EAGLE > GROVE", "EAST AURORA", "EAST CHICAGO", "EAST EARL", "EAST HANOVER", > "EAST HARTFORD", "EAST HARTLAND", "EAST LEROY", "EAST LIVERPOOL", > "EAST MEADOW", "EAST NORTHPORT", "EAST ORANGE", "EAST PEORIA", "EAST > SAINT LOUIS", "EASTON", "EDGERTON", "EDISON", "EDMOND", "EGG HBR TWP", > "EL DORADO", "EL PASO", "ELDRIDGE", "ELGIN", "ELIZABETHVILLE", > "ELLISVILLE", "ELLSWORTH", "ELLWOOD CITY", "ELMHURST", "ELMWOOD PARK", > "ELOY", "ELY", "EMERSON", "EMORY", "ENDICOTT", "ENGLEWOOD", "ENID", > "ENNICE", "ENOLA", "ENUMCLAW", "EPHRATA", "ERIE", "ESTERO", "EUREKA > SPRINGS", "EVANSVILLE", "EVERETT", "EXCELSIOR SPRINGS", "EXTON", > "FAIRFAX", "FAIRFIELD", "FAIRHAVEN", "FAIRVIEW", "FAIRVIEW PARK", > "FALMOUTH", "FAR HILLS", "FAR ROCKAWAY", "FARMINGDALE", "FARMINGTON", > "FAYETTE", "FAYETTEVILLE", "FELTON", "FENTON", "FERGUSON", "FIELDALE", > "FINDLAY", "FINGERVILLE", "FLEMINGTON", "FLINT", "FLORENCE", > "FLORESVILLE", "FLORISSANT", "FLOVILLA", "FLOWER MOUND", "FLUSHING", > "FOGELSVILLE", "FOLSOM", "FONTANELLE", "FOREST HILLS", "FOREST PARK", > "FORT DODGE", "FORT FAIRFIELD", "FORT GAY", "FORT LAUDERDALE", "FORT > LEE", "FORT MILL", "FORT MOHAVE", "FORT PAYNE", "FORT PIERCE", "FORT > SMITH", "FORT WAYNE", "FORT WORTH", "FOSTORIA", "FOUNTAIN INN", > "FRANKFORT", "FRANKLIN", "FREEDOM", "FREEHOLD", "FREEPORT", "FREMONT", > "FULLERTON", "FULSHEAR", "FULTON", "GADSDEN", "GAFFNEY", > "GAINESVILLE", "GALLOWAY", "GARDEN PRAIRIE", "GARDNERS", "GARNETT > VALLEY", "GARY", "GASTON", "GASTONIA", "GENEVA", "GETTYSBURG", > "GIBSONIA", "GILBERT", "GIRARD", "GLEN BURNIE", "GLEN CARBON", "GLEN > COVE", "GLEN MILLS", "GLENSHAW", "GLENVIEW", "GLENWOOD", "GOLDEN > CITY", "GOLIAD", "GOODSON", "GOODYEAR", "GORHAM", "GOSHEN", > "GRANBURY", "GRANBY", "GRAND PRAIRIE", "GRAND RAPIDS", "GRANDVIEW", > "GRANITE CITY", "GRANITE FALLS", "GRANTS PASS", "GRASS VALLEY", > "GRAVETTE", "GRAYSVILLE", "GREEN LANE", "GREENBRIER", "GREENLAWN", > "GREENSBORO", "GREENSBURG", "GREENUP", "GREENVILLE", "GREER", > "GRIFFIN", "GRIFFITH", "GROTON", "GUADALUPE", "GUILFORD", "HADLEY", > "HAGAN", "HALF WAY", "HALLANDALE BEACH", "HAMBLETON", "HAMBURG", > "HAMDEN", "HAMILTON", "HAMMOND", "HAMMONTON", "HAMPSHIRE", > "HAPEVILLE", "HARBORCREEK", "HARLAN", "HARRISBURG", "HARRISON", > "HARRISONVILLE", "HARTWELL", "HASTINGS", "HATFIELD", "HAVERHILL", > "HAWK POINT", "HAYESVILLE", "HELEN", "HENDERSON", "HENDERSONVILLE", > "HENRICO", "HENRIETTA", "HERMITAGE", "HERNDON", "HERSHEY", "HIALEAH", > "HIAWATHA", "HIBBING", "HICKORY", "HICKORY GROVE", "HIDDENITE", "HIGH > HILL", "HIGH POINT", "HIGH RIDGE", "HIGHLAND", "HIGHLAND MILLS", > "HINCKLEY", "HIRAM", "HOBART", "HOLBROOK", "HOLDEN", "HOLDENVILLE", > "HOLLADAY", "HOLLIS", "HOLLY SPRINGS", "HOLLYWOOD", "HOLTWOOD", > "HOMER", "HOMESTEAD", "HONEYVILLE", "HOPE MILLS", "HOT SPRINGS", "HOT > SPRINGS NATIONAL PARK", "HOUSTON", "HUBBARD", "HUDSON", "HUFFMAN", > "HULL", "HUMANSVILLE", "HUNTERSVILLE", "HUNTINGDON", "HUNTINGTON > BEACH", "HUNTS POINT", "HURDLE MILLS", "HURRICANE", "HURST", > "IMPERIAL", "INDEPENDENCE", "INDIAN SHORES", "INDIAN TRAIL", > "INDIANA", "INDIANAPOLIS", "INDIANOLA", "INMAN", "IOWA CITY", "IRMO", > "IRVINGTON", "IRWIN", "ISANTI", "ISLESBORO", "ISLIP", "ISSAQUAH", > "ITHACA", "JACKSBORO", "JACKSON", "JACKSON HTS", "JACKSONVILLE", > "JAMAICA", "JAMESTOWN", "JASPER", "JEANNETTE", "JEFFERSON", "JEFFERSON > CITY", "JEWELL", "JOHNSTON", "JOHNSTOWN", "JONESBORO", "JONESPORT", > "JONESTOWN", "JOPLIN", "JUPITER", "KANKAKEE", "KANNAPOLIS", "KANSAS > CITY", "KATY", "KEARNEY", "KELLERTON", "KEMAH", "KENMORE", "KENNESAW", > "KENT", "KINGMAN", "KINGS MOUNTAIN", "KINGSLAND", "KINGSTON", > "KINGWOOD", "KIRKLAND", "KUTZTOWN", "LA QUINTA", "LA RUE", "LA VERNE", > "LAFAYETTE", "LAKE BLUFF", "LAKE IN THE HILL", "LAKE ISABELLA", "LAKE > PLACID", "LAKE SAINT LOUIS", "LAKE TAPPS", "LAKE VILLAGE", "LAKE > WAUKOMIS", "LAKE WORTH", "LAKEBAY", "LAKELAND", "LAKEWOOD", "LAKEWOOD > RCH", "LAMBERTVILLE", "LANCASTER", "LANDISVILLE", "LANSDALE", > "LAREDO", "LARGO", "LAS VEGAS", "LATROBE", "LAUDERHILL", "LAWNDALE", > "LAWRENCE", "LAWRENCEVILLE", "LE MARS", "LE ROY", "LEAGUE CITY", > "LEAVENWORTH", "LEAWOOD", "LEBANON", "LECOMPTON", "LEECHBURG", "LEES > SUMMIT", "LEESBURG", "LEESVILLE", "LEETONIA", "LENEXA", "LENOIR", > "LEVITTOWN", "LEWES", "LEWISTOWN", "LEXINGTON", "LIBERTY TWP", > "LILLINGTON", "LINCOLN", "LINDENHURST", "LINTON", "LISBON", > "LITCHFIELD PK", "LITHIA", "LITITZ", "LITTLE EGG HARBOR TO", "LK > FOREST PK", "LK PEEKSKILL", "LOCKHART", "LOCKWOOD", "LOGAN", "LOMA > LINDA", "LONE JACK", "LONG BEACH", "LONG LANE", "LONGVIEW", "LORAIN", > "LORTON", "LOS ANGELES", "LOUISBURG", "LOVES PARK", "LOWER BURRELL", > "LOWRY CITY", "LUBBOCK", "LUGOFF", "LUMBERTON", "LYNBROOK", > "LYNNWOOD", "MACHESNEY PARK", "MACON", "MAGNOLIA", "MAHOPAC", > "MAHWAH", "MAINEVILLE", "MALVERN", "MALVERNE", "MANASSAS", "MANCHACA", > "MANCHESTER", "MANCHESTER TOWNSHIP", "MANCHESTER TW", "MANHEIM", > "MANITO", "MANLIUS", "MANNINGTON", "MANSFIELD", "MANSURA", "MAPLE > PARK", "MARBLE FALLS", "MARCELLUS", "MARICOPA", "MARIETTA", "MARION", > "MARKLEYSBURG", "MARS HILL", "MARSHALLTOWN", "MARSHFIELD", > "MARSHVILLE", "MARTINSVILLE", "MARYSVILLE", "MASON CITY", "MASSEY", > "MASSILLON", "MASURY", "MATAWAN", "MATEWAN", "MATTAPOISETT", > "MATTHEWS", "MAYFIELD HTS", "MAYSEL", "MC CLELLAND", "MC DONALD", "MC > KEES ROCKS", "MC SHERRYSTOWN", "MC VEYTOWN", "MCALESTER", "MCDONOUGH", > "MCKEESPORT", "MCKINNEY", "MECHANICSBURG", "MECHANICSVILLE", > "MEDFORD", "MEDIA", "MEDWAY", "MELVILLE", "MEMPHIS", "MERIDEN", > "MERRIAM", "MERRICK", "MERRILL", "MERRILLVILLE", "MESA", "MESQUITE", > "MIAMI", "MIAMI GARDENS", "MICHIGAN CITY", "MIDDLETOWN", "MIDLAND", > "MIFFLINTOWN", "MILFORD", "MILL CREEK", "MILLBROOK", "MILLEDGEVILLE", > "MILLINOCKET", "MILNER", "MILTON", "MILWAUKEE", "MINEOLA", "MINERAL > SPGS", "MINERAL WELLS", "MINNEAPOLIS", "MISSION", "MISSION HILLS", > "MISSION VIEJO", "MISSOURI CITY", "MISSOURI VALLEY", "MOLINE", > "MONESSEN", "MONROE", "MONROE TOWNSHIP", "MONROEVILLE", "MONTCLAIR", > "MONTEREY", "MONTICELLO", "MOORESVILLE", "MORGANTON", "MORGANTOWN", > "MORRIS PLAINS", "MOUND", "MOUND CITY", "MOUNT HOPE", "MOUNT JOY", > "MOUNT LAUREL", "MOUNT PLEASANT", "MOUNT POCONO", "MOUNT UNION", > "MOUNT WOLF", "MOUNTVILLE", "MT HOLLY", "MT PLEASANT", "MULVANE", > "MUNCIE", "MUNSTER", "MURFREESBORO", "MURRAY", "MURRELLS INLT", > "MUSTANG", "MYERSTOWN", "MYSTIC", "N BRANFORD", "N FT MYERS", > "NAPERVILLE", "NAPLES", "NAPOLEON", "NASHVILLE", "NATCHITOCHES", > "NAUGATUCK", "NEOSHO", "NEPTUNE BEACH", "NESCONSET", "NETCONG", "NEW > BLOOMFIELD", "NEW BRAUNFELS", "NEW BRITAIN", "NEW BRUNSWICK", "NEW > CASTLE", "NEW CUMBERLAND", "NEW HAVEN", "NEW KENSINGTON", "NEW > LONDON", "NEW ORLEANS", "NEW PRESTON", "NEW PROVIDENCE", "NEW > ROCHELLE", "NEW TRIPOLI", "NEW ULM", "NEW WINDSOR", "NEW YORK", > "NEWARK", "NEWBURGH HEIGHTS", "NEWINGTON", "NEWNAN", "NEWPORT", > "NEWPORT BEACH", "NEWTON", "NEWTONVILLE", "NIAGARA FALLS", "NIXA", > "NOANK", "NOKOMIS", "NORCROSS", "NORFOLK", "NORMAN", "NORMANDY PARK", > "NORTH BABYLON", "NORTH HAVEN", "NORTH HUNTINGDON", "NORTH JACKSON", > "NORTH LITTLE ROCK", "NORTH MIAMI", "NORTH PORT", "NORTH RICHLAND > HILLS", "NORTH WALES", "NORTH WATERBORO", "NORTHFIELD", "NORTHRIDGE", > "NORTON", "NORWALK", "NOTTINGHAM", "NUTLEY", "NYACK", "O FALLON", "OAK > RIDGE", "OAKDALE", "OCALA", "OCEANSIDE", "OCILLA", "OLATHE", "OMAHA", > "OMRO", "ONA", "ONALASKA", "OPA LOCKA", "ORADLL", "ORION", "ORONO", > "ORRINGTON", "OSCEOLA", "OSKALOOSA", "OSSINING", "OSWEGO", "OTTAWA", > "OVALO", "OVERLAND PARK", "OWASSO", "OWEGO", "OXFORD", "OYSTER BAY", > "OZARK", "PALERMO", "PALM CITY", "PALM HARBOR", "PALMDALE", "PALMYRA", > "PALOS HEIGHTS", "PANA", "PAOLA", "PARK RIDGE", "PARLIN", "PARMA", > "PARRISH", "PARROTT", "PATASKALA", "PAULS VALLEY", "PAXTON", "PEA > RIDGE", "PEARLAND", "PECULIAR", "PEEKSKILL", "PEKIN", "PELION", > "PEMBROKE", "PEMBROKE PINES", "PENN YAN", "PENNELLVILLE", "PENNSBURG", > "PENNSVILLE", "PEORIA", "PERRY", "PERRYOPOLIS", "PERRYSBURG", > "PERRYVILLE", "PHARR", "PHILADELPHIA", "PHILIPPI", "PHOENIX", > "PICKENS", "PICKERINGTON", "PIERSON", "PILOT MOUNTAIN", "PINE BLUFF", > "PINE HILL", "PINEVILLE", "PINNELLAS PARK", "PISCATAWAY", "PITMAN", > "PITTSBURGH", "PLACIDA", "PLAINFIELD", "PLANO", "PLANT CITY", > "PLATTEKILL", "PLEASANT HILL", "PLEASANT HOPE", "PLYMOUTH", "POCONO > LAKE", "POMFRET CENTER", "POMPANO BEACH", "POOLER", "PORT CARBON", > "PORT CHARLOTTE", "PORT NORRIS", "PORT ORANGE", "PORT SAINT LUCIE", > "PORT WASHINGTON", "PORTAGE", "PORTER", "PORTERSVILLE", "PORTLAND", > "POTTSVILLE", "POUGHKEEPSIE", "POWDER SPRINGS", "POWELL", "PRAIRIE > VILLAGE", "PRESCOTT", "PRESCOTT VALLEY", "PRINCETON", "PROSPECT", "PT > PLEASANT", "PUNTA GORDA", "PURCHASE", "QUAKERTOWN", "QUEENS VLG", > "QUINCY", "RALEIGH", "RANDLEMAN", "RANDOLPH", "RAYTOWN", "READING", > "READLYN", "RED BANK", "RED HOUSE", "RED LION", "REEDERS", "REGO > PARK", "REHOBOTH BCH", "REIDSVILLE", "RENO", "RENTON", "REPUBLIC", > "RICH HILL", "RICHARDS", "RICHMOND", "RICHMOND HILL", "RIDGEWOOD", > "RINCON", "RIO GRANDE CITY", "RIO RANCHO", "RIVERDALE", "RIVERHEAD", > "RIVERSIDE", "ROANOKE", "ROCHELLE", "ROCHESTER", "ROCK HILL", > "ROCKAWAY BCH", "ROCKFORD", "ROCKMART", "ROCKY HILL", "ROCKY MOUNT", > "ROGERS", "ROGERSVILLE", "ROMULUS", "ROOSEVELT", "ROSAMOND", "ROSCOE", > "ROSENBERG", "ROSENDALE", "ROSWELL", "ROTONDA WEST", "ROUGEMONT", > "ROXBORO", "ROY", "RUNNELLS", "RURAL HALL", "RUSH VALLEY", "RUSKIN", > "RUSTBURG", "RUTHER GLEN", "RUTHERFORDTON", "S DEERFIELD", "SACO", > "SAGINAW", "SAINT AUGUSTINE", "SAINT CHARLES", "SAINT CLAIR", "SAINT > CLAIRSVILLE", "SAINT LOUIS", "SAINT MARYS", "SAINT MATTHEWS", "SAINT > PAULS", "SAINT PETERS", "SAINT PETERSBURG", "SALEM", "SALISBURY", > "SALT LAKE CITY", "SALTSBURG", "SALUNGA", "SAMMAMISH", "SAN ANTONIO", > "SAN BENITO", "SAN CLEMENTE", "SAN DIEGO", "SAN ELIZARIO", "SAN JUAN", > "SANDUSKY", "SANDY", "SANFORD", "SANGERVILLE", "SANTA ANA", > "SARASOTA", "SARATOGA SPRINGS", "SARCOXIE", "SAUGUS", "SAVANNAH", > "SAYVILLE", "SCALY MOUNTAIN", "SCHAEFFERSTOWN", "SCHULENBURG", > "SCOTT", "SCOTTSDALE", "SEAFORD", "SEALE", "SEATTLE", "SEDONA", > "SEGUIN", "SELDEN", "SENECA", "SENOIA", "SEVEN VALLEYS", "SEYMOUR", > "SHARON", "SHARPSBURG", "SHARPSVILLE", "SHAVANO PARK", "SHAWNEE", > "SHELLSBURG", "SHELTON", "SHENANDOAH", "SHORELINE", "SHOREWOOD", > "SHREVEPORT", "SICKLERVILLE", "SILER CITY", "SILOAM SPRINGS", "SIMON", > "SIMPSONVILLE", "SIMSBURY", "SIOUX CITY", "SIOUX FALLS", "SKOKIE", > "SKOWHEGAN", "SLATINGTON", "SLIDELL", "SMITHFIELD", "SN BERNRDNO", > "SNELLVILLE", "SOCORRO", "SOMERS", "SOPHIA", "SOUTH AMBOY", "SOUTH > BELOIT", "SOUTH BEND", "SOUTH DARTMOUTH", "SOUTH HOUSTON", "SOUTH > PARK", "SOUTH PLAINFIELD", "SOUTH SIOUX CITY", "SOUTHAMPTON", > "SOUTHBURY", "SOUTHGATE", "SPARKS", "SPARROW BUSH", "SPENCER", > "SPRING", "SPRING BRANCH", "SPRING GROVE", "SPRING HILL", "SPRING > HOPE", "SPRING VALLEY", "SPRINGDALE", "SPRINGFIELD", "SPRINGFIELD > GARDENS", "SPRINGHILL", "SPRINGTOWN", "SPRNGFLD GDNS", "SPRUCE PINE", > "ST PETERSBURG", "ST. GEORGE", "STAFFORD", "STAMFORD", "STANDISH", > "STANLEY", "STANTON", "STATEN ISLAND", "STATESVILLE", "STERLING", > "STILLMAN VALLEY", "STILWELL", "STOCKBRIDGE", "STOCKTON", "STONE MTN", > "STRAFFORD", "STRATFORD", "STRONGSVILLE", "STROUDSBURG", "STRUTHERS", > "SUFFIELD", "SUGAR HILL", "SUGAR LAND", "SULPHUR", "SUMMERVILLE", > "SUMMIT", "SUN CITY", "SUNBURY", "SUWANEE", "SWANSEA", "SWANTON", > "SWEENY", "SWISSVALE", "SYCAMORE", "SYLVANIA", "SYRACUSE", "TACOMA", > "TAFTVILLE", "TAMPA", "TAPPAHANNOCK", "TAR HEEL", "TAUNTON", > "TAYLORVILLE", "TECUMSEH", "THE WOODLANDS", "THEODOSIA", "THOMASTON", > "THOMASVILLE", "TIERRA VERDE", "TIFTON", "TILLSON", "TILTON", "TINLEY > PARK", "TOCCOA", "TOLEDO", "TOLLAND", "TOMBALL", "TOMS RIVER", > "TOPEKA", "TOPSHAM", "TORRINGTON", "TOVEY", "TOWNSEND", "TRAVELERS > RST", "TRENT", "TRINITY", "TROUTMAN", "TROY", "TRUMBULL", "TUCKER", > "TULALIP", "TURNER", "TUSCUMBIA", "TYRONE", "UNION", "UNION CITY", > "UNIVERSAL CTY", "UNIVERSITY HTS", "UPPR CHICHSTR", "URBANA", > "URBANDALE", "UTICA", "VAIL", "VALE", "VALENCIA", "VALPARAISO", "VAN > BUREN", "VAN METER", "VAN WERT", "VANDERGRIFT", "VASSALBORO", > "VAUGHN", "VENICE", "VERNAL", "VERNON", "VERONA", "VICTOR", "VIDALIA", > "VIENNA", "VILLA GROVE", "VILLA RIDGE", "VOLANT", "W HAMPTON BCH", "W > TERRE HAUTE", "WADSWORTH", "WAHOO", "WAKE FOREST", "WALDEN", > "WALLINGFORD", "WALLINGTON", "WALNUT COVE", "WANAQUE", "WARFORDSBURG", > "WARMINSTER", "WARREN", "WARSAW", "WARTHEN", "WASHINGTON", "WASOLA", > "WATAUGA", "WATERBURY", "WATERFORD", "WATERLOO", "WATERVILLE", > "WATKINS GLEN", "WAXAHACHIE", "WAYCROSS", "WAYNESBORO", "WEBSTER", > "WEIRTON", "WELLSBORO", "WELLSVILLE", "WENTZVILLE", "WESLACO", "WEST > CHESTER", "WEST DEPTFORD", "WEST DES MOINES", "WEST HAVEN", "WEST > HICKORY", "WEST LIBERTY", "WEST MIFFLIN", "WEST PALM BEACH", "WEST > POINT", "WEST READING", "WEST SENECA", "WEST SUFFIELD", "WEST VALLEY > CITY", "WESTERVILLE", "WESTHAMPTON", "WESTMINSTER", "WESTMORELAND > CITY", "WESTPORT", "WESTVILLE", "WETHERSFIELD", "WHARTON", "WHEELING", > "WHITE PLAINS", "WHITEHALL", "WHITESTONE", "WHITESTOWN", "WHITING", > "WHITMAN", "WHITTIER", "WICHITA", "WILDWOOD", "WILLARD", > "WILLIAMSBURG", "WILLIAMSPORT", "WILLOW GROVE", "WILLOWBROOK", > "WILLOWICK", "WILMETTE", "WILMINGTON", "WILSON", "WILTON MANORS", > "WIMBERLEY", "WINDCREST", "WINDER", "WINNEBAGO", "WINSIDE", "WINSTON", > "WINSTON SALEM", "WINTERSET", "WINTHROP", "WOLCOTT", "WOODBRIDGE", > "WOODBURY HEIGHTS", "WOODLAND PARK", "WOODLAWN", "WOODS CROSS", > "WOODSIDE", "WOODSTOCK", "WORTHINGTON", "WYOMISSING", "YARMOUTH", > "YOE", "YONKERS", "YORK", "YORKTOWN", "YORKTOWN HEIGHTS", "YOUNG HARRIS", "YOUNGSTOWN", "YPSILANTI", "ZELIENOPLE", "ZEPHYRHILLS"), class = "factor"), > clusters = c(6L, 10L, 3L, 10L, 5L, 6L, 10L, 6L, 6L, 7L, 5L, > 7L, 8L, 8L, 3L, 6L, 3L, 10L, 7L, 10L, 10L, 4L, 2L, 8L, 9L, > 1L, 4L, 4L, 7L, 5L, 10L, 5L, 5L, 10L, 6L, 6L, 10L, 6L, 7L, > 10L, 10L, 3L, 3L, 6L, 3L), Longitude = c(-93.883554, -90.582058, > -83.868923, -89.544083, -72.902467, -94.458904, -90.588533, > -94.527843, -92.93769, -80.029456, -70.58809, -82.888789, > -80.113071, -82.6661, -81.372992, -95.840964, -82.016013, > -89.92625, -80.276676, -89.778385, -87.641063, -94.888036, > -117.663119, -82.530568, -75.574437, -122.209047, -96.799309, > -95.746255, -80.553953, -73.923314, -87.713482, -73.9731, > -73.8187, -87.987023, -93.759478, -94.110903, -90.00597, > -93.257109, -79.932483, -90.201858, -89.100233, -84.625923, > -84.567614, -93.912921, -84.612564), Latitude = c(34.503045, > 38.752515, 33.406527, 40.893588, 41.733088, 38.999032, 41.657674, > 38.890929, 37.639766, 42.099693, 43.53462, 40.142492, 26.538149, > 27.9062, 31.90104, 34.833083, 35.118836, 35.136047, 39.425712, > 40.519207, 40.101126, 30.044457, 33.62287, 27.910276, 39.752254, > 47.403778, 32.961929, 29.820199, 38.408649, 40.668828, 41.983948, > 40.58116, 40.7253, 41.921667, 41.669921, 36.442552, 38.564663, > 37.455315, 40.867774, 38.783554, 42.244381, 34.024332, 34.001644, > 36.622704, 34.017832), distances_Me = c(1879089.079, 1437296.523, > 1185638.742, 1313997.97, 156759.9125, 1759443.351, 1398398.997, > 1767861.917, 1668917.322, 534234.2576, 431749.2965, 758508.4701, > 1657031.938, 1615575.668, 1169085.702, 2024642.021, 930944.4681, > 1525322.746, 553069.7532, 1337002.822, 1161367.37, 2223496.376, > 3918520.212, 1609088.602, 164252.5146, 3878581.001, 2197910.688, > 2304526.789, 614908.3151, 11075.24597, 1160375.454, 494.2997496, > 21063.72622, 1182681.434, 1662351.873, 1810881.911, 1393581.436, > 1701982.013, 504395.772, 1404348.991, 1276505.454, 1190457.718, > 1188029.899, 1787261.336, 1189994.055), distances_Mi = c(1167.607468, > 893.0913246, 736.719012, 816.477441, 97.40573055, 1093.263337, > 868.9216123, 1098.494372, 1037.01328, 331.9565399, 268.2755749, > 471.3135552, 1029.628072, 1003.868436, 726.4334682, 1258.049536, > 578.4599174, 947.7880794, 343.6603307, 830.7719404, 721.6375366, > 1381.611443, 2434.846498, 999.8375755, 102.0614003, 2410.029515, > 1365.713293, 1431.96122, 382.0848884, 6.881813138, 721.0211909, > 0.30714248, 13.08834388, 734.8814328, 1032.933715, 1125.225657, > 865.9281298, 1057.55865, 313.4158337, 872.6187534, 793.1807589, > 739.7133739, 738.2048023, 1110.548567, 739.4252678), ID = > 2308:2352), row.names = c(NA, -45L), class = "data.frame") > > Proprietary > > NOTICE TO RECIPIENT OF INFORMATION:\ This e-mail may > con...{{dropped:16}} > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mail > man_listinfo_r-2Dhelp&d=DwIBaQ&c=wluqKIiwffOpZ6k5sqMWMBOn0vyYnlulRJmmv > OXCFpM&r=j7MrcIQm2xjHa8v-2mTpmTCtKvneM2ExlYvnUWbsByY&m=sRhKIDOv4AuwrfD > BU9b2Rpj-VPfs0lcpkQqNBfVLSe4&s=CloI44kowc5J_mOah6vx_Kl4PFIeqxmwexvRiqw > xuOA&e= PLEASE do read the posting guide > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.or > g_posting-2Dguide.html&d=DwIBaQ&c=wluqKIiwffOpZ6k5sqMWMBOn0vyYnlulRJmm > vOXCFpM&r=j7MrcIQm2xjHa8v-2mTpmTCtKvneM2ExlYvnUWbsByY&m=sRhKIDOv4Auwrf > DBU9b2Rpj-VPfs0lcpkQqNBfVLSe4&s=iOWreiJDomXv-uJ3NzQNX0IUsupILo_4DmkFK3 > GRUig&e= and provide commented, minimal, self-contained, reproducible > code.NOTICE TO RECIPIENT OF INFORMATION: This e-mail may contain confidential or privileged information. If you think you have received this e-mail in error, please advise the sender by reply e-mail and then delete this e-mail immediately. This e-mail may also contain protected health information (PHI) with information about sensitive medical conditions, including, but not limited to, treatment for substance use disorders, behavioral health, HIV/AIDS, or pregnancy. This type of information may be protected by various federal and/or state laws which prohibit any further disclosure without the express written consent of the person to whom it pertains or as otherwise permitted by law. Any unauthorized further disclosure may be considered a violation of federal and/or state law. A general authorization for the release of medical or other information may NOT be sufficient consent for release of this type of information. Thank you. Aetna
Hello Jim, et.al, again. One last question please. Since this routine works best with larger volume of geo points, is there a way to modify this routine to accommodate more than one cluster and differentiated by different colors? #Single cluster routine clus3 <- individual_dets_sf_3X %>% dplyr::select(MBR_SUBSCRIBERID,state,city,clusters,Latitude,Longitude,distances_Mi) %>% #Notice now that these are capitalized <--"L" filter(clusters == 3) str(clus3) clus3 <- as.data.frame(clus3) geomat<-makeDensityMatrix(clus3[,c("Latitude","Longitude")], xlim=range(clus3$Longitude),ylim=range(clus3$Latitude)) # Range of density (>0) - 1.292155 3.89646 latlim<-range(clus3$Latitude) lonlim<-range(clus3$Longitude) map("world",xlim=lonlim,ylim=latlim) axis(1) axis(2) densityGrid(geomat,range.cex=c(1,5),xlim=lonlim,ylim=latlim, red=c(0.5,1),green=0,blue=0,pch=15) title("Member Geo Density Plot For Cluster3") knitr::kable(individual_dets_sf_3X %>% group_by(clusters) %>% tally(sort = TRUE)) # | clusters| n| # |--------:|---:| # | 3| 384| # | 5| 335| # | 9| 305| # | 7| 298| # | 10| 286| # | 6| 279| # | 4| 168| # | 8| 131| # | 2| 113| # | 1| 53| 'data.frame': 384 obs. of 7 variables: $ MBR_SUBSCRIBERID: Factor w/ 2352 levels "101040199600",..: 908 2272 1613 1357 1952 1437 795 1634 1160 902 ... $ state : Factor w/ 41 levels "AL","AR","AZ",..: 10 23 23 10 33 10 10 23 10 10 ... $ city : Factor w/ 1337 levels "ABBOTTSTOWN",..: 156 496 354 827 670 1161 897 970 249 494 ... $ clusters : num 3 3 3 3 3 3 3 3 3 3 ... $ Latitude : num 31.2 35.3 36.5 33.4 34.2 ... $ Longitude : num -81.5 -82.4 -81 -84.7 -80.7 ... $ distances_Mi : num 770 586 471 769 573 ... Proprietary -----Original Message----- From: Poling, William Sent: Thursday, May 14, 2020 7:03 AM To: Jim Lemon <drjimlemon at gmail.com> Cc: r-help at r-project.org; Mark Fowler <gmark.fowler at outlook.com> Subject: RE: [EXTERNAL] Re: [R] Help with map() Hi, it is working now using just the most necessary pkgs. Evidently when there are so few rows (clus1=53) the map does not cooperate, I get the plot but no map image? As I increase records the map begins to appear as it did for Radius1-8 routines Thank you for your time and trouble my friends. WHP Proprietary -----Original Message----- From: Poling, William Sent: Thursday, May 14, 2020 6:46 AM To: Jim Lemon <drjimlemon at gmail.com> Cc: r-help at r-project.org; Mark Fowler <gmark.fowler at outlook.com> Subject: RE: [EXTERNAL] Re: [R] Help with map() Hi, I ran this which is partially successful. I got long & lat (x&y) with red plot values however, no map behind it? Not sure what I might be missing now in terms of pkgs I suppose? #Just use the basic pkgs library(magrittr)#for %>% function library(plotrix) library(maps) library(dplyr)#For filter() str(individual_dets_sf_3X) str(radius3) str(clus1) #rm(clus1) clus1 <- individual_dets_sf_3X %>% dplyr::select(MBR_SUBSCRIBERID,state,city,clusters,Latitude,Longitude,distances_Mi) %>% #Notice now that these are capitalized <--"L" filter(clusters == 1) str(clus1) clus1 <- as.data.frame(clus1) geomat<-makeDensityMatrix(clus1[,c("Latitude","Longitude")], xlim=range(clus1$Longitude),ylim=range(clus1$Latitude)) # Range of density (>0) - 1.292155 3.89646 latlim<-range(clus1$Latitude) lonlim<-range(clus1$Longitude) map("world",xlim=lonlim,ylim=latlim) axis(1) axis(2) densityGrid(geomat,range.cex=c(1,5),xlim=lonlim,ylim=latlim, red=c(0.5,1),green=0,blue=0,pch=15) title("Member Geo Density Plot For Cluster1") Proprietary -----Original Message----- From: Poling, William Sent: Thursday, May 14, 2020 6:29 AM To: Jim Lemon <drjimlemon at gmail.com> Cc: r-help at r-project.org; Mark Fowler <gmark.fowler at outlook.com> Subject: RE: [EXTERNAL] Re: [R] Help with map() Hi Jim, and Mark, thank you for your response. 1. I have restarted R 2. I have only initiated library(magrittr)#for %>% function & library(plotrix), no other libraries thinking that another may be overwriting something. 3. I have checked the str() str(radius3) 'data.frame': 1990 obs. of 6 variables: $ MBR_SUBSCRIBERID: Factor w/ 2352 levels "101040199600",..: 590 908 976 509 1674 690 1336 726 1702 2331 ... $ state : Factor w/ 41 levels "AL","AR","AZ",..: 32 10 25 11 9 32 13 12 12 17 ... $ city : Factor w/ 1337 levels "ABBOTTSTOWN",..: 932 156 230 698 965 1330 515 1127 1304 1316 ... $ Latitude : num 40.4 31.2 40.8 42.1 26.8 ... $ Longitude : num -79.9 -81.5 -74 -91.6 -82.1 ... $ distances_Mi : num 310.3 769.9 16.1 920.4 1057.6 ... str(clus1) tibble [53 x 7] (S3: tbl_df/tbl/data.frame) $ MBR_SUBSCRIBERID: Factor w/ 2352 levels "101040199600",..: 86 2111 995 899 953 924 769 92 790 1748 ... $ state : Factor w/ 41 levels "AL","AR","AZ",..: 31 39 4 39 39 39 39 31 39 39 ... $ city : Factor w/ 1337 levels "ABBOTTSTOWN",..: 727 85 455 1018 1203 604 1169 727 984 295 ... $ clusters : num [1:53] 1 1 1 1 1 1 1 1 1 1 ... $ Latitude : num [1:53] 42.4 47.6 39.2 46.9 48 ... $ Longitude : num [1:53] -123 -122 -121 -123 -122 ... $ distances_Mi : num [1:53] 2499 2406 2472 2430 2408 ... 4. I change clus1 to DF 'data.frame': 53 obs. of 7 variables: $ MBR_SUBSCRIBERID: Factor w/ 2352 levels "101040199600",..: 86 2111 995 899 953 924 769 92 790 1748 ... $ state : Factor w/ 41 levels "AL","AR","AZ",..: 31 39 4 39 39 39 39 31 39 39 ... $ city : Factor w/ 1337 levels "ABBOTTSTOWN",..: 727 85 455 1018 1203 604 1169 727 984 295 ... $ clusters : num 1 1 1 1 1 1 1 1 1 1 ... $ Latitude : num 42.4 47.6 39.2 46.9 48 ... $ Longitude : num -123 -122 -121 -123 -122 ... $ distances_Mi : num 2499 2406 2472 2430 2408 ... Then try again, no luck? Weird? Thanks WHP Proprietary -----Original Message----- From: Jim Lemon <drjimlemon at gmail.com> Sent: Thursday, May 14, 2020 5:44 AM To: Poling, William <PolingW at aetna.com> Cc: r-help at r-project.org Subject: [EXTERNAL] Re: [R] Help with map() **** External Email - Use Caution **** Hi Bill, Have you compared str(radius3) to str(clus1)? It may be quite different. Jim On Thu, May 14, 2020 at 8:24 PM Poling, William via R-help <r-help at r-project.org> wrote:> > #RStudio Version Version 1.2.1335 > sessionInfo() > # R version 4.0.0 Patched (2020-05-03 r78349) > #Platform: x86_64-w64-mingw32/x64 (64-bit) #Running under: Windows 10 > x64 (build 17763) > > Good morning. > > I ran routines like this one yesterday with no errors. > > #Radius3---- > str(radius3) > > radius3 <- individual_dets_sf_3X %>% > > dplyr::select(MBR_SUBSCRIBERID,state,city,Latitude,Longitude,distances_Mi) %>% > filter(distances_Mi <= 1200) > > str(radius3) > > geomat<-makeDensityMatrix(radius3[,c("Latitude","Longitude")], > > xlim=range(radius3$Longitude),ylim=range(radius3$Latitude)) > > latlim<-range(radius3$Latitude) > lonlim<-range(radius3$Longitude) > > <- map("world",xlim=lonlim,ylim=latlim) > axis(1) > axis(2) > densityGrid(geomat,range.cex=c(1,5),xlim=lonlim,ylim=latlim, > red=c(0.5,1),green=0,blue=0,pch=15) > title("Member Geo Density Plot For Radius3") > > > This morning I am trying slightly new routine and receiving this error > > clus1 <- individual_dets_sf_3X %>% > > dplyr::select(MBR_SUBSCRIBERID,state,city,clusters,Latitude,Longitude,distances_Mi) %>% > filter(clusters == 1) > > geomat<-makeDensityMatrix(clus1[,c("Latitude","Longitude")], > > xlim=range(clus1$Longitude),ylim=range(clus1$Latitude)) > > latlim<-range(clus1$Latitude) > lonlim<-range(clus1$Longitude) > > map("world",xlim=lonlim,ylim=latlim) > axis(1) > axis(2) > densityGrid(geomat,range.cex=c(1,5),xlim=lonlim,ylim=latlim, > red=c(0.5,1),green=0,blue=0,pch=15) > title("Member Geo Density Plot For Cluster1") > > > geomat<-makeDensityMatrix(clus1[,c("Latitude","Longitude")], > + > + xlim=range(clus1$Longitude),ylim=range(clus1$Latitude)) > > > latlim<-range(clus1$Latitude) > > lonlim<-range(clus1$Longitude) > > > > map("world",xlim=lonlim,ylim=latlim) > Error in .C(C_map_type, as.character(mapbase), integer(1)) : > Incorrect number of arguments (2), expecting 0 for '' > > axis(1) > Error in axis(1) : plot.new has not been called yet > > axis(2) > Error in axis(2) : plot.new has not been called yet > > densityGrid(geomat,range.cex=c(1,5),xlim=lonlim,ylim=latlim, > + red=c(0.5,1),green=0,blue=0,pch=15) > Error in plot.xy(xy.coords(x, y), type = type, ...) : > plot.new has not been called yet > > title("Member Geo Density Plot For Cluster1") > Error in title("Member Geo Density Plot For Cluster1") : > plot.new has not been called yet > > > It seems to error at the point of map("world",xlim=lonlim,ylim=latlim) > > I find a ref in stack overflow > https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com > _questions_45066628_cannot-2Drun-2Dmap-2Ddatastate&d=DwIBaQ&c=wluqKIiw > ffOpZ6k5sqMWMBOn0vyYnlulRJmmvOXCFpM&r=j7MrcIQm2xjHa8v-2mTpmTCtKvneM2Ex > lYvnUWbsByY&m=sRhKIDOv4AuwrfDBU9b2Rpj-VPfs0lcpkQqNBfVLSe4&s=sEjkBzlaFR > 7NhUDpUPGPp1nOkAxOlBbFNadLowcDbFw&e> and tried solutions but they do not seem to work? > > Here is a sample (MBR_SUBSCRIBERID(factor) is replaced with ID(integer) but of no consequence in my routine since not really used. > > I hope someone recognizes the problem. > > Thank you for any advice > > WHP > > > dput(sample) > structure(list(state = structure(c(2L, 22L, 10L, 12L, 6L, 22L, 11L, > 22L, 22L, 32L, 19L, 29L, 9L, 9L, 10L, 30L, 33L, 35L, 41L, 12L, 12L, > 36L, 4L, 9L, 8L, 39L, 36L, 36L, 41L, 28L, 12L, 28L, 28L, 12L, 11L, 2L, > 12L, 22L, 32L, 22L, 12L, 10L, 10L, 22L, 10L ), .Label = c("AL", "AR", > "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "IA", "IL", "IN", > "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO", "NC", "NE", > "NJ", "NM", "NV", "NY", "OH", "OK", "OR", "PA", "SC", "SD", "TN", > "TX", "UT", "VA", "WA", "WI", "WV" > ), class = "factor"), city = structure(c(838L, 1030L, 262L, 218L, > 166L, 973L, 339L, 451L, 660L, 358L, 281L, 1280L, 129L, 223L, 989L, > 721L, 550L, 731L, 1325L, 688L, 1184L, 281L, 759L, 1171L, 1305L, 587L, > 272L, 581L, 263L, 152L, 217L, 152L, 390L, 5L, 571L, 1006L, 1162L, > 939L, 170L, 1033L, 1002L, 586L, 586L, 192L, 586L ), .Label = > c("ABBOTTSTOWN", "ABILENE", "ACWORTH", "ADAMS", "ADDISON", "ADKINS", > "ALBANY", "ALBIA", "ALBUQUERQUE", "ALEXANDRIA", "ALFRED", "ALIQUIPPA", > "ALISO VIEJO", "ALLEN PARK", "ALLENTOWN", "ALPHA", "ALPHARETTA", > "ALPINE", "ALTOONA", "AMARILLO", "AMBLER", "AMBRIDGE", "AMHERST", > "AMITYVILLE", "ANAHIEM", "ANDERSON", "ANDOVER", "ANGIER", "ANGLETON", > "ANKENY", "ANN ARBOR", "ANZA", "APEX", "APOLLO", "ARCADIA", > "ARCHDALE", "ARDMORE", "ARGYLE", "ARKANSAS CITY", "ARLINGTON", > "ARNOLD", "ARTHUR", "ASHEBORO", "ASHEVILLE", "ASHLAND", "ASHLAND > CITY", "ASHTON", "ASTON", "ATHENS", "ATLANTA", "ATLANTIC BCH", > "AUBORN", "AUGUSTA", "AURORA", "AUSTELL", "AUSTIN", "AVENTURA", > "AVONDALE ESTATES", "BAKERSFIELD", "BALDWIN CITY", "BALDWIN PLACE", > "BALLWIN", "BANGOR", "BARBOURSVILLE", "BARNEGAT", "BARTLETT", > "BARTON", "BARTONVILLE", "BASSETT", "BATAVIA", "BATESBURG", "BATON > ROUGE", "BAXTER SPRINGS", "BAY CITY", "BAYONNE", "BAYSIDE", "BAYTOWN", > "BEAR", "BEAUMONT", "BEECH CREEK", "BEECHER CITY", "BELFAIR", "BELLE > VERNON", "BELLEAIR", "BELLEVUE", "BELLMAWR", "BELLMORE", "BELLWOOD", > "BELMAR", "BELMONT", "BELVIDERE", "BENNET", "BENTON", "BENTONVILLE", > "BERLIN", "BESSEMER CITY", "BETHANY", "BETHEL", "BETHEL PARK", > "BETHESDA", "BETHLEHEM", "BETTENDORF", "BIGLERVILLE", "BINGHAMTON", > "BIRDSBORO", "BIWABIK", "BLACK MOUNTAIN", "BLACKSBURG", "BLAINE", > "BLAIRSVILLE", "BLAKESLEE", "BLOOMFIELD", "BLUE BELL", "BLUE GRASS", > "BLUE POINT", "BLUE SPRINGS", "BOCA RATON", "BODFISH", "BOILING > SPRINGS", "BOLIVAR", "BON AQUA", "BONNER SPRINGS", "BONNEY LAKE", > "BOONEVILLE", "BOSSIER CITY", "BOUNTIFUL", "BOWLING GREEN", > "BOYERTOWN", "BOYNTON BEACH", "BRADENTON", "BRADENVILLE", > "BRANDAMORE", "BRANDON", "BRANFORD", "BRANSON", "BRASELTON", > "BREEZEWOOD", "BRENTON", "BRENTWOOD", "BREWSTER", "BRICK", > "BRIDGEPORT", "BRIDGETON", "BRIGHAM CITY", "BROADDUS", "BROCKPORT", > "BROGUE", "BROKEN ARROW", "BRONX", "BROOKFIELD", "BROOKHAVEN", > "BROOKLYN", "BROWNS MILLS", "BROWNSBURG", "BROWNSVILLE", "BRUNSWICK", > "BRYAN", "BUCKSPORT", "BUDD LAKE", "BUFFALO", "BULVERDE", > "BUNKERVILLE", "BURBANK", "BURFORD", "BURIEN", "BURLINGTON", "BURR > RIDGE", "BURTON", "BUSKIRK", "BUTLER", "BUXTON", "BYRON", "CALERA", > "CAMBRIDGE", "CAMP HILL", "CAMPBELL", "CANAAN", "CANAL WINCHESTER", > "CANASTOTA", "CANTON", "CARDIFF BY THE SEA", "CARL JUNCTION", > "CARLISLE", "CARLTON", "CAROL STREAM", "CARROLLTON", "CARSON CITY", > "CARTERSVILLE", "CARTHAGE", "CARY", "CASEYVILLE", "CASSVILLE", > "CASWELL", "CATO", "CEDAR RAPIDS", "CEDARBURG", "CEDARVILLE", "CENTER > POINT", "CENTERTON", "CENTRAL ISLIP", "CENTRAL POINT", "CHAGRIN > FALLS", "CHALFONT", "CHAPEL HILL", "CHAPIN", "CHARDON", "CHARITON", > "CHARLESTON", "CHARLOTTE", "CHEROKEE", "CHERRY HILL", "CHERRY VALLEY", > "CHESHIRE", "CHEST SPRINGS", "CHESTER", "CHESTERTON", "CHICAGO", > "CHILLICOTHE", "CHOCTAW", "CICERO", "CINCINNATI", "CLAY", > "CLEARWATER", "CLEARWATER BEACH", "CLEMMONS", "CLENDENIN", > "CLEVELAND", "CLEVELAND HTS", "CLEVES", "CLIFFSIDE PARK", "CLIFTON", > "CLIFTON PARK", "CLIFTON SPGS", "CLINTON", "COACHELLA", "COAL > TOWNSHIP", "COATESVILLE", "COLLEGE STATION", "COLLINSVILLE", > "COLONIA", "COLUMBIA", "COLUMBUS", "COMMERCE", "CONCORD", "CONCORD > TOWNSHIP", "CONNELLSVILLE", "CONROE", "CONWAY", "CONYERS", > "COOKEVILLE", "COON RAPIDS", "CORAOPOLIS", "CORDOVA", "CORNELIUS", > "CORNWALL", "CORONADO", "CORPUS CHRISTI", "CORRY", "COTTAGE HILLS", > "COTTLEVILLE", "COTTONWOOD", "COVINGTON", "COWEN", "CRANBERRY > TOWNSHIP", "CROWN POINT", "CUBA", "CUMBERLAND CENTER", "CUMBERLAND > FORESIDE", "CUMMING", "CUYAHOGA FLS", "CYPRESS", "DALLAS", > "DALLASTOWN", "DANBURY", "DANIA BCH", "DANVILLE", "DAVENPORT", > "DAVIE", "DAVIS JUNCTION", "DAWSON", "DAYTON", "DE SOTO", "DECATUR", > "DEFIANCE", "DEFOREST", "DELAVAN", "DELMAR", "DELRAY BEACH", > "DEMOTTE", "DENISON", "DENVER", "DEPTFORD", "DERBY", "DERRY", "DES > MOINES", "DETROIT", "DICKINSON", "DILLSBURG", "DITTMER", "DIXON", > "DONNA", "DOTHAN", "DOUGLAS", "DOUGLASVILLE", "DOVER", "DOYLESTOWN", > "DREXEL HILL", "DUBLIN", "DUCHESNE", "DULUTH", "DUNCAN", "DUNCANNON", > "DUNCANSVILLE", "DUNEDIN", "DUNNSVILLE", "DURHAM", "DUTTON", "EAGLE > GROVE", "EAST AURORA", "EAST CHICAGO", "EAST EARL", "EAST HANOVER", > "EAST HARTFORD", "EAST HARTLAND", "EAST LEROY", "EAST LIVERPOOL", > "EAST MEADOW", "EAST NORTHPORT", "EAST ORANGE", "EAST PEORIA", "EAST > SAINT LOUIS", "EASTON", "EDGERTON", "EDISON", "EDMOND", "EGG HBR TWP", > "EL DORADO", "EL PASO", "ELDRIDGE", "ELGIN", "ELIZABETHVILLE", > "ELLISVILLE", "ELLSWORTH", "ELLWOOD CITY", "ELMHURST", "ELMWOOD PARK", > "ELOY", "ELY", "EMERSON", "EMORY", "ENDICOTT", "ENGLEWOOD", "ENID", > "ENNICE", "ENOLA", "ENUMCLAW", "EPHRATA", "ERIE", "ESTERO", "EUREKA > SPRINGS", "EVANSVILLE", "EVERETT", "EXCELSIOR SPRINGS", "EXTON", > "FAIRFAX", "FAIRFIELD", "FAIRHAVEN", "FAIRVIEW", "FAIRVIEW PARK", > "FALMOUTH", "FAR HILLS", "FAR ROCKAWAY", "FARMINGDALE", "FARMINGTON", > "FAYETTE", "FAYETTEVILLE", "FELTON", "FENTON", "FERGUSON", "FIELDALE", > "FINDLAY", "FINGERVILLE", "FLEMINGTON", "FLINT", "FLORENCE", > "FLORESVILLE", "FLORISSANT", "FLOVILLA", "FLOWER MOUND", "FLUSHING", > "FOGELSVILLE", "FOLSOM", "FONTANELLE", "FOREST HILLS", "FOREST PARK", > "FORT DODGE", "FORT FAIRFIELD", "FORT GAY", "FORT LAUDERDALE", "FORT > LEE", "FORT MILL", "FORT MOHAVE", "FORT PAYNE", "FORT PIERCE", "FORT > SMITH", "FORT WAYNE", "FORT WORTH", "FOSTORIA", "FOUNTAIN INN", > "FRANKFORT", "FRANKLIN", "FREEDOM", "FREEHOLD", "FREEPORT", "FREMONT", > "FULLERTON", "FULSHEAR", "FULTON", "GADSDEN", "GAFFNEY", > "GAINESVILLE", "GALLOWAY", "GARDEN PRAIRIE", "GARDNERS", "GARNETT > VALLEY", "GARY", "GASTON", "GASTONIA", "GENEVA", "GETTYSBURG", > "GIBSONIA", "GILBERT", "GIRARD", "GLEN BURNIE", "GLEN CARBON", "GLEN > COVE", "GLEN MILLS", "GLENSHAW", "GLENVIEW", "GLENWOOD", "GOLDEN > CITY", "GOLIAD", "GOODSON", "GOODYEAR", "GORHAM", "GOSHEN", > "GRANBURY", "GRANBY", "GRAND PRAIRIE", "GRAND RAPIDS", "GRANDVIEW", > "GRANITE CITY", "GRANITE FALLS", "GRANTS PASS", "GRASS VALLEY", > "GRAVETTE", "GRAYSVILLE", "GREEN LANE", "GREENBRIER", "GREENLAWN", > "GREENSBORO", "GREENSBURG", "GREENUP", "GREENVILLE", "GREER", > "GRIFFIN", "GRIFFITH", "GROTON", "GUADALUPE", "GUILFORD", "HADLEY", > "HAGAN", "HALF WAY", "HALLANDALE BEACH", "HAMBLETON", "HAMBURG", > "HAMDEN", "HAMILTON", "HAMMOND", "HAMMONTON", "HAMPSHIRE", > "HAPEVILLE", "HARBORCREEK", "HARLAN", "HARRISBURG", "HARRISON", > "HARRISONVILLE", "HARTWELL", "HASTINGS", "HATFIELD", "HAVERHILL", > "HAWK POINT", "HAYESVILLE", "HELEN", "HENDERSON", "HENDERSONVILLE", > "HENRICO", "HENRIETTA", "HERMITAGE", "HERNDON", "HERSHEY", "HIALEAH", > "HIAWATHA", "HIBBING", "HICKORY", "HICKORY GROVE", "HIDDENITE", "HIGH > HILL", "HIGH POINT", "HIGH RIDGE", "HIGHLAND", "HIGHLAND MILLS", > "HINCKLEY", "HIRAM", "HOBART", "HOLBROOK", "HOLDEN", "HOLDENVILLE", > "HOLLADAY", "HOLLIS", "HOLLY SPRINGS", "HOLLYWOOD", "HOLTWOOD", > "HOMER", "HOMESTEAD", "HONEYVILLE", "HOPE MILLS", "HOT SPRINGS", "HOT > SPRINGS NATIONAL PARK", "HOUSTON", "HUBBARD", "HUDSON", "HUFFMAN", > "HULL", "HUMANSVILLE", "HUNTERSVILLE", "HUNTINGDON", "HUNTINGTON > BEACH", "HUNTS POINT", "HURDLE MILLS", "HURRICANE", "HURST", > "IMPERIAL", "INDEPENDENCE", "INDIAN SHORES", "INDIAN TRAIL", > "INDIANA", "INDIANAPOLIS", "INDIANOLA", "INMAN", "IOWA CITY", "IRMO", > "IRVINGTON", "IRWIN", "ISANTI", "ISLESBORO", "ISLIP", "ISSAQUAH", > "ITHACA", "JACKSBORO", "JACKSON", "JACKSON HTS", "JACKSONVILLE", > "JAMAICA", "JAMESTOWN", "JASPER", "JEANNETTE", "JEFFERSON", "JEFFERSON > CITY", "JEWELL", "JOHNSTON", "JOHNSTOWN", "JONESBORO", "JONESPORT", > "JONESTOWN", "JOPLIN", "JUPITER", "KANKAKEE", "KANNAPOLIS", "KANSAS > CITY", "KATY", "KEARNEY", "KELLERTON", "KEMAH", "KENMORE", "KENNESAW", > "KENT", "KINGMAN", "KINGS MOUNTAIN", "KINGSLAND", "KINGSTON", > "KINGWOOD", "KIRKLAND", "KUTZTOWN", "LA QUINTA", "LA RUE", "LA VERNE", > "LAFAYETTE", "LAKE BLUFF", "LAKE IN THE HILL", "LAKE ISABELLA", "LAKE > PLACID", "LAKE SAINT LOUIS", "LAKE TAPPS", "LAKE VILLAGE", "LAKE > WAUKOMIS", "LAKE WORTH", "LAKEBAY", "LAKELAND", "LAKEWOOD", "LAKEWOOD > RCH", "LAMBERTVILLE", "LANCASTER", "LANDISVILLE", "LANSDALE", > "LAREDO", "LARGO", "LAS VEGAS", "LATROBE", "LAUDERHILL", "LAWNDALE", > "LAWRENCE", "LAWRENCEVILLE", "LE MARS", "LE ROY", "LEAGUE CITY", > "LEAVENWORTH", "LEAWOOD", "LEBANON", "LECOMPTON", "LEECHBURG", "LEES > SUMMIT", "LEESBURG", "LEESVILLE", "LEETONIA", "LENEXA", "LENOIR", > "LEVITTOWN", "LEWES", "LEWISTOWN", "LEXINGTON", "LIBERTY TWP", > "LILLINGTON", "LINCOLN", "LINDENHURST", "LINTON", "LISBON", > "LITCHFIELD PK", "LITHIA", "LITITZ", "LITTLE EGG HARBOR TO", "LK > FOREST PK", "LK PEEKSKILL", "LOCKHART", "LOCKWOOD", "LOGAN", "LOMA > LINDA", "LONE JACK", "LONG BEACH", "LONG LANE", "LONGVIEW", "LORAIN", > "LORTON", "LOS ANGELES", "LOUISBURG", "LOVES PARK", "LOWER BURRELL", > "LOWRY CITY", "LUBBOCK", "LUGOFF", "LUMBERTON", "LYNBROOK", > "LYNNWOOD", "MACHESNEY PARK", "MACON", "MAGNOLIA", "MAHOPAC", > "MAHWAH", "MAINEVILLE", "MALVERN", "MALVERNE", "MANASSAS", "MANCHACA", > "MANCHESTER", "MANCHESTER TOWNSHIP", "MANCHESTER TW", "MANHEIM", > "MANITO", "MANLIUS", "MANNINGTON", "MANSFIELD", "MANSURA", "MAPLE > PARK", "MARBLE FALLS", "MARCELLUS", "MARICOPA", "MARIETTA", "MARION", > "MARKLEYSBURG", "MARS HILL", "MARSHALLTOWN", "MARSHFIELD", > "MARSHVILLE", "MARTINSVILLE", "MARYSVILLE", "MASON CITY", "MASSEY", > "MASSILLON", "MASURY", "MATAWAN", "MATEWAN", "MATTAPOISETT", > "MATTHEWS", "MAYFIELD HTS", "MAYSEL", "MC CLELLAND", "MC DONALD", "MC > KEES ROCKS", "MC SHERRYSTOWN", "MC VEYTOWN", "MCALESTER", "MCDONOUGH", > "MCKEESPORT", "MCKINNEY", "MECHANICSBURG", "MECHANICSVILLE", > "MEDFORD", "MEDIA", "MEDWAY", "MELVILLE", "MEMPHIS", "MERIDEN", > "MERRIAM", "MERRICK", "MERRILL", "MERRILLVILLE", "MESA", "MESQUITE", > "MIAMI", "MIAMI GARDENS", "MICHIGAN CITY", "MIDDLETOWN", "MIDLAND", > "MIFFLINTOWN", "MILFORD", "MILL CREEK", "MILLBROOK", "MILLEDGEVILLE", > "MILLINOCKET", "MILNER", "MILTON", "MILWAUKEE", "MINEOLA", "MINERAL > SPGS", "MINERAL WELLS", "MINNEAPOLIS", "MISSION", "MISSION HILLS", > "MISSION VIEJO", "MISSOURI CITY", "MISSOURI VALLEY", "MOLINE", > "MONESSEN", "MONROE", "MONROE TOWNSHIP", "MONROEVILLE", "MONTCLAIR", > "MONTEREY", "MONTICELLO", "MOORESVILLE", "MORGANTON", "MORGANTOWN", > "MORRIS PLAINS", "MOUND", "MOUND CITY", "MOUNT HOPE", "MOUNT JOY", > "MOUNT LAUREL", "MOUNT PLEASANT", "MOUNT POCONO", "MOUNT UNION", > "MOUNT WOLF", "MOUNTVILLE", "MT HOLLY", "MT PLEASANT", "MULVANE", > "MUNCIE", "MUNSTER", "MURFREESBORO", "MURRAY", "MURRELLS INLT", > "MUSTANG", "MYERSTOWN", "MYSTIC", "N BRANFORD", "N FT MYERS", > "NAPERVILLE", "NAPLES", "NAPOLEON", "NASHVILLE", "NATCHITOCHES", > "NAUGATUCK", "NEOSHO", "NEPTUNE BEACH", "NESCONSET", "NETCONG", "NEW > BLOOMFIELD", "NEW BRAUNFELS", "NEW BRITAIN", "NEW BRUNSWICK", "NEW > CASTLE", "NEW CUMBERLAND", "NEW HAVEN", "NEW KENSINGTON", "NEW > LONDON", "NEW ORLEANS", "NEW PRESTON", "NEW PROVIDENCE", "NEW > ROCHELLE", "NEW TRIPOLI", "NEW ULM", "NEW WINDSOR", "NEW YORK", > "NEWARK", "NEWBURGH HEIGHTS", "NEWINGTON", "NEWNAN", "NEWPORT", > "NEWPORT BEACH", "NEWTON", "NEWTONVILLE", "NIAGARA FALLS", "NIXA", > "NOANK", "NOKOMIS", "NORCROSS", "NORFOLK", "NORMAN", "NORMANDY PARK", > "NORTH BABYLON", "NORTH HAVEN", "NORTH HUNTINGDON", "NORTH JACKSON", > "NORTH LITTLE ROCK", "NORTH MIAMI", "NORTH PORT", "NORTH RICHLAND > HILLS", "NORTH WALES", "NORTH WATERBORO", "NORTHFIELD", "NORTHRIDGE", > "NORTON", "NORWALK", "NOTTINGHAM", "NUTLEY", "NYACK", "O FALLON", "OAK > RIDGE", "OAKDALE", "OCALA", "OCEANSIDE", "OCILLA", "OLATHE", "OMAHA", > "OMRO", "ONA", "ONALASKA", "OPA LOCKA", "ORADLL", "ORION", "ORONO", > "ORRINGTON", "OSCEOLA", "OSKALOOSA", "OSSINING", "OSWEGO", "OTTAWA", > "OVALO", "OVERLAND PARK", "OWASSO", "OWEGO", "OXFORD", "OYSTER BAY", > "OZARK", "PALERMO", "PALM CITY", "PALM HARBOR", "PALMDALE", "PALMYRA", > "PALOS HEIGHTS", "PANA", "PAOLA", "PARK RIDGE", "PARLIN", "PARMA", > "PARRISH", "PARROTT", "PATASKALA", "PAULS VALLEY", "PAXTON", "PEA > RIDGE", "PEARLAND", "PECULIAR", "PEEKSKILL", "PEKIN", "PELION", > "PEMBROKE", "PEMBROKE PINES", "PENN YAN", "PENNELLVILLE", "PENNSBURG", > "PENNSVILLE", "PEORIA", "PERRY", "PERRYOPOLIS", "PERRYSBURG", > "PERRYVILLE", "PHARR", "PHILADELPHIA", "PHILIPPI", "PHOENIX", > "PICKENS", "PICKERINGTON", "PIERSON", "PILOT MOUNTAIN", "PINE BLUFF", > "PINE HILL", "PINEVILLE", "PINNELLAS PARK", "PISCATAWAY", "PITMAN", > "PITTSBURGH", "PLACIDA", "PLAINFIELD", "PLANO", "PLANT CITY", > "PLATTEKILL", "PLEASANT HILL", "PLEASANT HOPE", "PLYMOUTH", "POCONO > LAKE", "POMFRET CENTER", "POMPANO BEACH", "POOLER", "PORT CARBON", > "PORT CHARLOTTE", "PORT NORRIS", "PORT ORANGE", "PORT SAINT LUCIE", > "PORT WASHINGTON", "PORTAGE", "PORTER", "PORTERSVILLE", "PORTLAND", > "POTTSVILLE", "POUGHKEEPSIE", "POWDER SPRINGS", "POWELL", "PRAIRIE > VILLAGE", "PRESCOTT", "PRESCOTT VALLEY", "PRINCETON", "PROSPECT", "PT > PLEASANT", "PUNTA GORDA", "PURCHASE", "QUAKERTOWN", "QUEENS VLG", > "QUINCY", "RALEIGH", "RANDLEMAN", "RANDOLPH", "RAYTOWN", "READING", > "READLYN", "RED BANK", "RED HOUSE", "RED LION", "REEDERS", "REGO > PARK", "REHOBOTH BCH", "REIDSVILLE", "RENO", "RENTON", "REPUBLIC", > "RICH HILL", "RICHARDS", "RICHMOND", "RICHMOND HILL", "RIDGEWOOD", > "RINCON", "RIO GRANDE CITY", "RIO RANCHO", "RIVERDALE", "RIVERHEAD", > "RIVERSIDE", "ROANOKE", "ROCHELLE", "ROCHESTER", "ROCK HILL", > "ROCKAWAY BCH", "ROCKFORD", "ROCKMART", "ROCKY HILL", "ROCKY MOUNT", > "ROGERS", "ROGERSVILLE", "ROMULUS", "ROOSEVELT", "ROSAMOND", "ROSCOE", > "ROSENBERG", "ROSENDALE", "ROSWELL", "ROTONDA WEST", "ROUGEMONT", > "ROXBORO", "ROY", "RUNNELLS", "RURAL HALL", "RUSH VALLEY", "RUSKIN", > "RUSTBURG", "RUTHER GLEN", "RUTHERFORDTON", "S DEERFIELD", "SACO", > "SAGINAW", "SAINT AUGUSTINE", "SAINT CHARLES", "SAINT CLAIR", "SAINT > CLAIRSVILLE", "SAINT LOUIS", "SAINT MARYS", "SAINT MATTHEWS", "SAINT > PAULS", "SAINT PETERS", "SAINT PETERSBURG", "SALEM", "SALISBURY", > "SALT LAKE CITY", "SALTSBURG", "SALUNGA", "SAMMAMISH", "SAN ANTONIO", > "SAN BENITO", "SAN CLEMENTE", "SAN DIEGO", "SAN ELIZARIO", "SAN JUAN", > "SANDUSKY", "SANDY", "SANFORD", "SANGERVILLE", "SANTA ANA", > "SARASOTA", "SARATOGA SPRINGS", "SARCOXIE", "SAUGUS", "SAVANNAH", > "SAYVILLE", "SCALY MOUNTAIN", "SCHAEFFERSTOWN", "SCHULENBURG", > "SCOTT", "SCOTTSDALE", "SEAFORD", "SEALE", "SEATTLE", "SEDONA", > "SEGUIN", "SELDEN", "SENECA", "SENOIA", "SEVEN VALLEYS", "SEYMOUR", > "SHARON", "SHARPSBURG", "SHARPSVILLE", "SHAVANO PARK", "SHAWNEE", > "SHELLSBURG", "SHELTON", "SHENANDOAH", "SHORELINE", "SHOREWOOD", > "SHREVEPORT", "SICKLERVILLE", "SILER CITY", "SILOAM SPRINGS", "SIMON", > "SIMPSONVILLE", "SIMSBURY", "SIOUX CITY", "SIOUX FALLS", "SKOKIE", > "SKOWHEGAN", "SLATINGTON", "SLIDELL", "SMITHFIELD", "SN BERNRDNO", > "SNELLVILLE", "SOCORRO", "SOMERS", "SOPHIA", "SOUTH AMBOY", "SOUTH > BELOIT", "SOUTH BEND", "SOUTH DARTMOUTH", "SOUTH HOUSTON", "SOUTH > PARK", "SOUTH PLAINFIELD", "SOUTH SIOUX CITY", "SOUTHAMPTON", > "SOUTHBURY", "SOUTHGATE", "SPARKS", "SPARROW BUSH", "SPENCER", > "SPRING", "SPRING BRANCH", "SPRING GROVE", "SPRING HILL", "SPRING > HOPE", "SPRING VALLEY", "SPRINGDALE", "SPRINGFIELD", "SPRINGFIELD > GARDENS", "SPRINGHILL", "SPRINGTOWN", "SPRNGFLD GDNS", "SPRUCE PINE", > "ST PETERSBURG", "ST. GEORGE", "STAFFORD", "STAMFORD", "STANDISH", > "STANLEY", "STANTON", "STATEN ISLAND", "STATESVILLE", "STERLING", > "STILLMAN VALLEY", "STILWELL", "STOCKBRIDGE", "STOCKTON", "STONE MTN", > "STRAFFORD", "STRATFORD", "STRONGSVILLE", "STROUDSBURG", "STRUTHERS", > "SUFFIELD", "SUGAR HILL", "SUGAR LAND", "SULPHUR", "SUMMERVILLE", > "SUMMIT", "SUN CITY", "SUNBURY", "SUWANEE", "SWANSEA", "SWANTON", > "SWEENY", "SWISSVALE", "SYCAMORE", "SYLVANIA", "SYRACUSE", "TACOMA", > "TAFTVILLE", "TAMPA", "TAPPAHANNOCK", "TAR HEEL", "TAUNTON", > "TAYLORVILLE", "TECUMSEH", "THE WOODLANDS", "THEODOSIA", "THOMASTON", > "THOMASVILLE", "TIERRA VERDE", "TIFTON", "TILLSON", "TILTON", "TINLEY > PARK", "TOCCOA", "TOLEDO", "TOLLAND", "TOMBALL", "TOMS RIVER", > "TOPEKA", "TOPSHAM", "TORRINGTON", "TOVEY", "TOWNSEND", "TRAVELERS > RST", "TRENT", "TRINITY", "TROUTMAN", "TROY", "TRUMBULL", "TUCKER", > "TULALIP", "TURNER", "TUSCUMBIA", "TYRONE", "UNION", "UNION CITY", > "UNIVERSAL CTY", "UNIVERSITY HTS", "UPPR CHICHSTR", "URBANA", > "URBANDALE", "UTICA", "VAIL", "VALE", "VALENCIA", "VALPARAISO", "VAN > BUREN", "VAN METER", "VAN WERT", "VANDERGRIFT", "VASSALBORO", > "VAUGHN", "VENICE", "VERNAL", "VERNON", "VERONA", "VICTOR", "VIDALIA", > "VIENNA", "VILLA GROVE", "VILLA RIDGE", "VOLANT", "W HAMPTON BCH", "W > TERRE HAUTE", "WADSWORTH", "WAHOO", "WAKE FOREST", "WALDEN", > "WALLINGFORD", "WALLINGTON", "WALNUT COVE", "WANAQUE", "WARFORDSBURG", > "WARMINSTER", "WARREN", "WARSAW", "WARTHEN", "WASHINGTON", "WASOLA", > "WATAUGA", "WATERBURY", "WATERFORD", "WATERLOO", "WATERVILLE", > "WATKINS GLEN", "WAXAHACHIE", "WAYCROSS", "WAYNESBORO", "WEBSTER", > "WEIRTON", "WELLSBORO", "WELLSVILLE", "WENTZVILLE", "WESLACO", "WEST > CHESTER", "WEST DEPTFORD", "WEST DES MOINES", "WEST HAVEN", "WEST > HICKORY", "WEST LIBERTY", "WEST MIFFLIN", "WEST PALM BEACH", "WEST > POINT", "WEST READING", "WEST SENECA", "WEST SUFFIELD", "WEST VALLEY > CITY", "WESTERVILLE", "WESTHAMPTON", "WESTMINSTER", "WESTMORELAND > CITY", "WESTPORT", "WESTVILLE", "WETHERSFIELD", "WHARTON", "WHEELING", > "WHITE PLAINS", "WHITEHALL", "WHITESTONE", "WHITESTOWN", "WHITING", > "WHITMAN", "WHITTIER", "WICHITA", "WILDWOOD", "WILLARD", > "WILLIAMSBURG", "WILLIAMSPORT", "WILLOW GROVE", "WILLOWBROOK", > "WILLOWICK", "WILMETTE", "WILMINGTON", "WILSON", "WILTON MANORS", > "WIMBERLEY", "WINDCREST", "WINDER", "WINNEBAGO", "WINSIDE", "WINSTON", > "WINSTON SALEM", "WINTERSET", "WINTHROP", "WOLCOTT", "WOODBRIDGE", > "WOODBURY HEIGHTS", "WOODLAND PARK", "WOODLAWN", "WOODS CROSS", > "WOODSIDE", "WOODSTOCK", "WORTHINGTON", "WYOMISSING", "YARMOUTH", > "YOE", "YONKERS", "YORK", "YORKTOWN", "YORKTOWN HEIGHTS", "YOUNG HARRIS", "YOUNGSTOWN", "YPSILANTI", "ZELIENOPLE", "ZEPHYRHILLS"), class = "factor"), > clusters = c(6L, 10L, 3L, 10L, 5L, 6L, 10L, 6L, 6L, 7L, 5L, > 7L, 8L, 8L, 3L, 6L, 3L, 10L, 7L, 10L, 10L, 4L, 2L, 8L, 9L, > 1L, 4L, 4L, 7L, 5L, 10L, 5L, 5L, 10L, 6L, 6L, 10L, 6L, 7L, > 10L, 10L, 3L, 3L, 6L, 3L), Longitude = c(-93.883554, -90.582058, > -83.868923, -89.544083, -72.902467, -94.458904, -90.588533, > -94.527843, -92.93769, -80.029456, -70.58809, -82.888789, > -80.113071, -82.6661, -81.372992, -95.840964, -82.016013, > -89.92625, -80.276676, -89.778385, -87.641063, -94.888036, > -117.663119, -82.530568, -75.574437, -122.209047, -96.799309, > -95.746255, -80.553953, -73.923314, -87.713482, -73.9731, > -73.8187, -87.987023, -93.759478, -94.110903, -90.00597, > -93.257109, -79.932483, -90.201858, -89.100233, -84.625923, > -84.567614, -93.912921, -84.612564), Latitude = c(34.503045, > 38.752515, 33.406527, 40.893588, 41.733088, 38.999032, 41.657674, > 38.890929, 37.639766, 42.099693, 43.53462, 40.142492, 26.538149, > 27.9062, 31.90104, 34.833083, 35.118836, 35.136047, 39.425712, > 40.519207, 40.101126, 30.044457, 33.62287, 27.910276, 39.752254, > 47.403778, 32.961929, 29.820199, 38.408649, 40.668828, 41.983948, > 40.58116, 40.7253, 41.921667, 41.669921, 36.442552, 38.564663, > 37.455315, 40.867774, 38.783554, 42.244381, 34.024332, 34.001644, > 36.622704, 34.017832), distances_Me = c(1879089.079, 1437296.523, > 1185638.742, 1313997.97, 156759.9125, 1759443.351, 1398398.997, > 1767861.917, 1668917.322, 534234.2576, 431749.2965, 758508.4701, > 1657031.938, 1615575.668, 1169085.702, 2024642.021, 930944.4681, > 1525322.746, 553069.7532, 1337002.822, 1161367.37, 2223496.376, > 3918520.212, 1609088.602, 164252.5146, 3878581.001, 2197910.688, > 2304526.789, 614908.3151, 11075.24597, 1160375.454, 494.2997496, > 21063.72622, 1182681.434, 1662351.873, 1810881.911, 1393581.436, > 1701982.013, 504395.772, 1404348.991, 1276505.454, 1190457.718, > 1188029.899, 1787261.336, 1189994.055), distances_Mi = c(1167.607468, > 893.0913246, 736.719012, 816.477441, 97.40573055, 1093.263337, > 868.9216123, 1098.494372, 1037.01328, 331.9565399, 268.2755749, > 471.3135552, 1029.628072, 1003.868436, 726.4334682, 1258.049536, > 578.4599174, 947.7880794, 343.6603307, 830.7719404, 721.6375366, > 1381.611443, 2434.846498, 999.8375755, 102.0614003, 2410.029515, > 1365.713293, 1431.96122, 382.0848884, 6.881813138, 721.0211909, > 0.30714248, 13.08834388, 734.8814328, 1032.933715, 1125.225657, > 865.9281298, 1057.55865, 313.4158337, 872.6187534, 793.1807589, > 739.7133739, 738.2048023, 1110.548567, 739.4252678), ID = > 2308:2352), row.names = c(NA, -45L), class = "data.frame") > > Proprietary > > NOTICE TO RECIPIENT OF INFORMATION:\ This e-mail may > con...{{dropped:16}} > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mail > man_listinfo_r-2Dhelp&d=DwIBaQ&c=wluqKIiwffOpZ6k5sqMWMBOn0vyYnlulRJmmv > OXCFpM&r=j7MrcIQm2xjHa8v-2mTpmTCtKvneM2ExlYvnUWbsByY&m=sRhKIDOv4AuwrfD > BU9b2Rpj-VPfs0lcpkQqNBfVLSe4&s=CloI44kowc5J_mOah6vx_Kl4PFIeqxmwexvRiqw > xuOA&e= PLEASE do read the posting guide > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.or > g_posting-2Dguide.html&d=DwIBaQ&c=wluqKIiwffOpZ6k5sqMWMBOn0vyYnlulRJmm > vOXCFpM&r=j7MrcIQm2xjHa8v-2mTpmTCtKvneM2ExlYvnUWbsByY&m=sRhKIDOv4Auwrf > DBU9b2Rpj-VPfs0lcpkQqNBfVLSe4&s=iOWreiJDomXv-uJ3NzQNX0IUsupILo_4DmkFK3 > GRUig&e= and provide commented, minimal, self-contained, reproducible > code.NOTICE TO RECIPIENT OF INFORMATION: This e-mail may contain confidential or privileged information. If you think you have received this e-mail in error, please advise the sender by reply e-mail and then delete this e-mail immediately. This e-mail may also contain protected health information (PHI) with information about sensitive medical conditions, including, but not limited to, treatment for substance use disorders, behavioral health, HIV/AIDS, or pregnancy. This type of information may be protected by various federal and/or state laws which prohibit any further disclosure without the express written consent of the person to whom it pertains or as otherwise permitted by law. Any unauthorized further disclosure may be considered a violation of federal and/or state law. A general authorization for the release of medical or other information may NOT be sufficient consent for release of this type of information. Thank you. Aetna
Hi Bill, I guess if you run makeDensityMatrix on subsets of the geographic locations and then overlay the different results with densityGrid using different colors, it should work as long as the regions don't overlap. Jim On Thu, May 14, 2020 at 10:20 PM Poling, William <PolingW at aetna.com> wrote:> > Hello Jim, et.al, again. > > One last question please. > > Since this routine works best with larger volume of geo points, is there a way to modify this routine to accommodate more than one cluster and differentiated by different colors? > > #Single cluster routine > clus3 <- individual_dets_sf_3X %>% > > dplyr::select(MBR_SUBSCRIBERID,state,city,clusters,Latitude,Longitude,distances_Mi) %>% #Notice now that these are capitalized <--"L" > > filter(clusters == 3) > > str(clus3) > > clus3 <- as.data.frame(clus3) > > geomat<-makeDensityMatrix(clus3[,c("Latitude","Longitude")], > xlim=range(clus3$Longitude),ylim=range(clus3$Latitude)) > # Range of density (>0) - 1.292155 3.89646 > latlim<-range(clus3$Latitude) > lonlim<-range(clus3$Longitude) > > map("world",xlim=lonlim,ylim=latlim) > axis(1) > axis(2) > densityGrid(geomat,range.cex=c(1,5),xlim=lonlim,ylim=latlim, > red=c(0.5,1),green=0,blue=0,pch=15) > title("Member Geo Density Plot For Cluster3") > > knitr::kable(individual_dets_sf_3X %>% group_by(clusters) %>% tally(sort = TRUE)) > > # | clusters| n| > # |--------:|---:| > # | 3| 384| > # | 5| 335| > # | 9| 305| > # | 7| 298| > # | 10| 286| > # | 6| 279| > # | 4| 168| > # | 8| 131| > # | 2| 113| > # | 1| 53| > > 'data.frame': 384 obs. of 7 variables: > $ MBR_SUBSCRIBERID: Factor w/ 2352 levels "101040199600",..: 908 2272 1613 1357 1952 1437 795 1634 1160 902 ... > $ state : Factor w/ 41 levels "AL","AR","AZ",..: 10 23 23 10 33 10 10 23 10 10 ... > $ city : Factor w/ 1337 levels "ABBOTTSTOWN",..: 156 496 354 827 670 1161 897 970 249 494 ... > $ clusters : num 3 3 3 3 3 3 3 3 3 3 ... > $ Latitude : num 31.2 35.3 36.5 33.4 34.2 ... > $ Longitude : num -81.5 -82.4 -81 -84.7 -80.7 ... > $ distances_Mi : num 770 586 471 769 573 ... > > > > > > Proprietary > > -----Original Message----- > From: Poling, William > Sent: Thursday, May 14, 2020 7:03 AM > To: Jim Lemon <drjimlemon at gmail.com> > Cc: r-help at r-project.org; Mark Fowler <gmark.fowler at outlook.com> > Subject: RE: [EXTERNAL] Re: [R] Help with map() > > Hi, it is working now using just the most necessary pkgs. > > Evidently when there are so few rows (clus1=53) the map does not cooperate, I get the plot but no map image? > > As I increase records the map begins to appear as it did for Radius1-8 routines > > Thank you for your time and trouble my friends. > > WHP > > > > > > Proprietary > > -----Original Message----- > From: Poling, William > Sent: Thursday, May 14, 2020 6:46 AM > To: Jim Lemon <drjimlemon at gmail.com> > Cc: r-help at r-project.org; Mark Fowler <gmark.fowler at outlook.com> > Subject: RE: [EXTERNAL] Re: [R] Help with map() > > Hi, I ran this which is partially successful. I got long & lat (x&y) with red plot values however, no map behind it? > > Not sure what I might be missing now in terms of pkgs I suppose? > #Just use the basic pkgs > library(magrittr)#for %>% function > library(plotrix) > library(maps) > library(dplyr)#For filter() > str(individual_dets_sf_3X) > str(radius3) > str(clus1) > > > #rm(clus1) > > clus1 <- individual_dets_sf_3X %>% > > dplyr::select(MBR_SUBSCRIBERID,state,city,clusters,Latitude,Longitude,distances_Mi) %>% #Notice now that these are capitalized <--"L" > > filter(clusters == 1) > > str(clus1) > > clus1 <- as.data.frame(clus1) > > geomat<-makeDensityMatrix(clus1[,c("Latitude","Longitude")], > xlim=range(clus1$Longitude),ylim=range(clus1$Latitude)) > # Range of density (>0) - 1.292155 3.89646 > latlim<-range(clus1$Latitude) > lonlim<-range(clus1$Longitude) > > map("world",xlim=lonlim,ylim=latlim) > axis(1) > axis(2) > densityGrid(geomat,range.cex=c(1,5),xlim=lonlim,ylim=latlim, > red=c(0.5,1),green=0,blue=0,pch=15) > title("Member Geo Density Plot For Cluster1") > > > > > > Proprietary > > -----Original Message----- > From: Poling, William > Sent: Thursday, May 14, 2020 6:29 AM > To: Jim Lemon <drjimlemon at gmail.com> > Cc: r-help at r-project.org; Mark Fowler <gmark.fowler at outlook.com> > Subject: RE: [EXTERNAL] Re: [R] Help with map() > > > Hi Jim, and Mark, thank you for your response. > > 1. I have restarted R > 2. I have only initiated library(magrittr)#for %>% function & library(plotrix), no other libraries thinking that another may be overwriting something. > 3. I have checked the str() > > str(radius3) > 'data.frame': 1990 obs. of 6 variables: > $ MBR_SUBSCRIBERID: Factor w/ 2352 levels "101040199600",..: 590 908 976 509 1674 690 1336 726 1702 2331 ... > $ state : Factor w/ 41 levels "AL","AR","AZ",..: 32 10 25 11 9 32 13 12 12 17 ... > $ city : Factor w/ 1337 levels "ABBOTTSTOWN",..: 932 156 230 698 965 1330 515 1127 1304 1316 ... > $ Latitude : num 40.4 31.2 40.8 42.1 26.8 ... > $ Longitude : num -79.9 -81.5 -74 -91.6 -82.1 ... > $ distances_Mi : num 310.3 769.9 16.1 920.4 1057.6 ... > > str(clus1) > tibble [53 x 7] (S3: tbl_df/tbl/data.frame) $ MBR_SUBSCRIBERID: Factor w/ 2352 levels "101040199600",..: 86 2111 995 899 953 924 769 92 790 1748 ... > $ state : Factor w/ 41 levels "AL","AR","AZ",..: 31 39 4 39 39 39 39 31 39 39 ... > $ city : Factor w/ 1337 levels "ABBOTTSTOWN",..: 727 85 455 1018 1203 604 1169 727 984 295 ... > $ clusters : num [1:53] 1 1 1 1 1 1 1 1 1 1 ... > $ Latitude : num [1:53] 42.4 47.6 39.2 46.9 48 ... > $ Longitude : num [1:53] -123 -122 -121 -123 -122 ... > $ distances_Mi : num [1:53] 2499 2406 2472 2430 2408 ... > > 4. I change clus1 to DF > 'data.frame': 53 obs. of 7 variables: > $ MBR_SUBSCRIBERID: Factor w/ 2352 levels "101040199600",..: 86 2111 995 899 953 924 769 92 790 1748 ... > $ state : Factor w/ 41 levels "AL","AR","AZ",..: 31 39 4 39 39 39 39 31 39 39 ... > $ city : Factor w/ 1337 levels "ABBOTTSTOWN",..: 727 85 455 1018 1203 604 1169 727 984 295 ... > $ clusters : num 1 1 1 1 1 1 1 1 1 1 ... > $ Latitude : num 42.4 47.6 39.2 46.9 48 ... > $ Longitude : num -123 -122 -121 -123 -122 ... > $ distances_Mi : num 2499 2406 2472 2430 2408 ... > > Then try again, no luck? > > Weird? > > Thanks > > WHP > > Proprietary > > -----Original Message----- > From: Jim Lemon <drjimlemon at gmail.com> > Sent: Thursday, May 14, 2020 5:44 AM > To: Poling, William <PolingW at aetna.com> > Cc: r-help at r-project.org > Subject: [EXTERNAL] Re: [R] Help with map() > > **** External Email - Use Caution **** > > Hi Bill, > Have you compared str(radius3) to str(clus1)? It may be quite different. > > Jim > > On Thu, May 14, 2020 at 8:24 PM Poling, William via R-help <r-help at r-project.org> wrote: > > > > #RStudio Version Version 1.2.1335 > > sessionInfo() > > # R version 4.0.0 Patched (2020-05-03 r78349) > > #Platform: x86_64-w64-mingw32/x64 (64-bit) #Running under: Windows 10 > > x64 (build 17763) > > > > Good morning. > > > > I ran routines like this one yesterday with no errors. > > > > #Radius3---- > > str(radius3) > > > > radius3 <- individual_dets_sf_3X %>% > > > > dplyr::select(MBR_SUBSCRIBERID,state,city,Latitude,Longitude,distances_Mi) %>% > > filter(distances_Mi <= 1200) > > > > str(radius3) > > > > geomat<-makeDensityMatrix(radius3[,c("Latitude","Longitude")], > > > > xlim=range(radius3$Longitude),ylim=range(radius3$Latitude)) > > > > latlim<-range(radius3$Latitude) > > lonlim<-range(radius3$Longitude) > > > > <- map("world",xlim=lonlim,ylim=latlim) > > axis(1) > > axis(2) > > densityGrid(geomat,range.cex=c(1,5),xlim=lonlim,ylim=latlim, > > red=c(0.5,1),green=0,blue=0,pch=15) > > title("Member Geo Density Plot For Radius3") > > > > > > This morning I am trying slightly new routine and receiving this error > > > > clus1 <- individual_dets_sf_3X %>% > > > > dplyr::select(MBR_SUBSCRIBERID,state,city,clusters,Latitude,Longitude,distances_Mi) %>% > > filter(clusters == 1) > > > > geomat<-makeDensityMatrix(clus1[,c("Latitude","Longitude")], > > > > xlim=range(clus1$Longitude),ylim=range(clus1$Latitude)) > > > > latlim<-range(clus1$Latitude) > > lonlim<-range(clus1$Longitude) > > > > map("world",xlim=lonlim,ylim=latlim) > > axis(1) > > axis(2) > > densityGrid(geomat,range.cex=c(1,5),xlim=lonlim,ylim=latlim, > > red=c(0.5,1),green=0,blue=0,pch=15) > > title("Member Geo Density Plot For Cluster1") > > > > > > geomat<-makeDensityMatrix(clus1[,c("Latitude","Longitude")], > > + > > + xlim=range(clus1$Longitude),ylim=range(clus1$Latitude)) > > > > > latlim<-range(clus1$Latitude) > > > lonlim<-range(clus1$Longitude) > > > > > > map("world",xlim=lonlim,ylim=latlim) > > Error in .C(C_map_type, as.character(mapbase), integer(1)) : > > Incorrect number of arguments (2), expecting 0 for '' > > > axis(1) > > Error in axis(1) : plot.new has not been called yet > > > axis(2) > > Error in axis(2) : plot.new has not been called yet > > > densityGrid(geomat,range.cex=c(1,5),xlim=lonlim,ylim=latlim, > > + red=c(0.5,1),green=0,blue=0,pch=15) > > Error in plot.xy(xy.coords(x, y), type = type, ...) : > > plot.new has not been called yet > > > title("Member Geo Density Plot For Cluster1") > > Error in title("Member Geo Density Plot For Cluster1") : > > plot.new has not been called yet > > > > > > It seems to error at the point of map("world",xlim=lonlim,ylim=latlim) > > > > I find a ref in stack overflow > > https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com > > _questions_45066628_cannot-2Drun-2Dmap-2Ddatastate&d=DwIBaQ&c=wluqKIiw > > ffOpZ6k5sqMWMBOn0vyYnlulRJmmvOXCFpM&r=j7MrcIQm2xjHa8v-2mTpmTCtKvneM2Ex > > lYvnUWbsByY&m=sRhKIDOv4AuwrfDBU9b2Rpj-VPfs0lcpkQqNBfVLSe4&s=sEjkBzlaFR > > 7NhUDpUPGPp1nOkAxOlBbFNadLowcDbFw&e> > and tried solutions but they do not seem to work? > > > > Here is a sample (MBR_SUBSCRIBERID(factor) is replaced with ID(integer) but of no consequence in my routine since not really used. > > > > I hope someone recognizes the problem. > > > > Thank you for any advice > > > > WHP > > > > > dput(sample) > > structure(list(state = structure(c(2L, 22L, 10L, 12L, 6L, 22L, 11L, > > 22L, 22L, 32L, 19L, 29L, 9L, 9L, 10L, 30L, 33L, 35L, 41L, 12L, 12L, > > 36L, 4L, 9L, 8L, 39L, 36L, 36L, 41L, 28L, 12L, 28L, 28L, 12L, 11L, 2L, > > 12L, 22L, 32L, 22L, 12L, 10L, 10L, 22L, 10L ), .Label = c("AL", "AR", > > "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "IA", "IL", "IN", > > "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO", "NC", "NE", > > "NJ", "NM", "NV", "NY", "OH", "OK", "OR", "PA", "SC", "SD", "TN", > > "TX", "UT", "VA", "WA", "WI", "WV" > > ), class = "factor"), city = structure(c(838L, 1030L, 262L, 218L, > > 166L, 973L, 339L, 451L, 660L, 358L, 281L, 1280L, 129L, 223L, 989L, > > 721L, 550L, 731L, 1325L, 688L, 1184L, 281L, 759L, 1171L, 1305L, 587L, > > 272L, 581L, 263L, 152L, 217L, 152L, 390L, 5L, 571L, 1006L, 1162L, > > 939L, 170L, 1033L, 1002L, 586L, 586L, 192L, 586L ), .Label > > c("ABBOTTSTOWN", "ABILENE", "ACWORTH", "ADAMS", "ADDISON", "ADKINS", > > "ALBANY", "ALBIA", "ALBUQUERQUE", "ALEXANDRIA", "ALFRED", "ALIQUIPPA", > > "ALISO VIEJO", "ALLEN PARK", "ALLENTOWN", "ALPHA", "ALPHARETTA", > > "ALPINE", "ALTOONA", "AMARILLO", "AMBLER", "AMBRIDGE", "AMHERST", > > "AMITYVILLE", "ANAHIEM", "ANDERSON", "ANDOVER", "ANGIER", "ANGLETON", > > "ANKENY", "ANN ARBOR", "ANZA", "APEX", "APOLLO", "ARCADIA", > > "ARCHDALE", "ARDMORE", "ARGYLE", "ARKANSAS CITY", "ARLINGTON", > > "ARNOLD", "ARTHUR", "ASHEBORO", "ASHEVILLE", "ASHLAND", "ASHLAND > > CITY", "ASHTON", "ASTON", "ATHENS", "ATLANTA", "ATLANTIC BCH", > > "AUBORN", "AUGUSTA", "AURORA", "AUSTELL", "AUSTIN", "AVENTURA", > > "AVONDALE ESTATES", "BAKERSFIELD", "BALDWIN CITY", "BALDWIN PLACE", > > "BALLWIN", "BANGOR", "BARBOURSVILLE", "BARNEGAT", "BARTLETT", > > "BARTON", "BARTONVILLE", "BASSETT", "BATAVIA", "BATESBURG", "BATON > > ROUGE", "BAXTER SPRINGS", "BAY CITY", "BAYONNE", "BAYSIDE", "BAYTOWN", > > "BEAR", "BEAUMONT", "BEECH CREEK", "BEECHER CITY", "BELFAIR", "BELLE > > VERNON", "BELLEAIR", "BELLEVUE", "BELLMAWR", "BELLMORE", "BELLWOOD", > > "BELMAR", "BELMONT", "BELVIDERE", "BENNET", "BENTON", "BENTONVILLE", > > "BERLIN", "BESSEMER CITY", "BETHANY", "BETHEL", "BETHEL PARK", > > "BETHESDA", "BETHLEHEM", "BETTENDORF", "BIGLERVILLE", "BINGHAMTON", > > "BIRDSBORO", "BIWABIK", "BLACK MOUNTAIN", "BLACKSBURG", "BLAINE", > > "BLAIRSVILLE", "BLAKESLEE", "BLOOMFIELD", "BLUE BELL", "BLUE GRASS", > > "BLUE POINT", "BLUE SPRINGS", "BOCA RATON", "BODFISH", "BOILING > > SPRINGS", "BOLIVAR", "BON AQUA", "BONNER SPRINGS", "BONNEY LAKE", > > "BOONEVILLE", "BOSSIER CITY", "BOUNTIFUL", "BOWLING GREEN", > > "BOYERTOWN", "BOYNTON BEACH", "BRADENTON", "BRADENVILLE", > > "BRANDAMORE", "BRANDON", "BRANFORD", "BRANSON", "BRASELTON", > > "BREEZEWOOD", "BRENTON", "BRENTWOOD", "BREWSTER", "BRICK", > > "BRIDGEPORT", "BRIDGETON", "BRIGHAM CITY", "BROADDUS", "BROCKPORT", > > "BROGUE", "BROKEN ARROW", "BRONX", "BROOKFIELD", "BROOKHAVEN", > > "BROOKLYN", "BROWNS MILLS", "BROWNSBURG", "BROWNSVILLE", "BRUNSWICK", > > "BRYAN", "BUCKSPORT", "BUDD LAKE", "BUFFALO", "BULVERDE", > > "BUNKERVILLE", "BURBANK", "BURFORD", "BURIEN", "BURLINGTON", "BURR > > RIDGE", "BURTON", "BUSKIRK", "BUTLER", "BUXTON", "BYRON", "CALERA", > > "CAMBRIDGE", "CAMP HILL", "CAMPBELL", "CANAAN", "CANAL WINCHESTER", > > "CANASTOTA", "CANTON", "CARDIFF BY THE SEA", "CARL JUNCTION", > > "CARLISLE", "CARLTON", "CAROL STREAM", "CARROLLTON", "CARSON CITY", > > "CARTERSVILLE", "CARTHAGE", "CARY", "CASEYVILLE", "CASSVILLE", > > "CASWELL", "CATO", "CEDAR RAPIDS", "CEDARBURG", "CEDARVILLE", "CENTER > > POINT", "CENTERTON", "CENTRAL ISLIP", "CENTRAL POINT", "CHAGRIN > > FALLS", "CHALFONT", "CHAPEL HILL", "CHAPIN", "CHARDON", "CHARITON", > > "CHARLESTON", "CHARLOTTE", "CHEROKEE", "CHERRY HILL", "CHERRY VALLEY", > > "CHESHIRE", "CHEST SPRINGS", "CHESTER", "CHESTERTON", "CHICAGO", > > "CHILLICOTHE", "CHOCTAW", "CICERO", "CINCINNATI", "CLAY", > > "CLEARWATER", "CLEARWATER BEACH", "CLEMMONS", "CLENDENIN", > > "CLEVELAND", "CLEVELAND HTS", "CLEVES", "CLIFFSIDE PARK", "CLIFTON", > > "CLIFTON PARK", "CLIFTON SPGS", "CLINTON", "COACHELLA", "COAL > > TOWNSHIP", "COATESVILLE", "COLLEGE STATION", "COLLINSVILLE", > > "COLONIA", "COLUMBIA", "COLUMBUS", "COMMERCE", "CONCORD", "CONCORD > > TOWNSHIP", "CONNELLSVILLE", "CONROE", "CONWAY", "CONYERS", > > "COOKEVILLE", "COON RAPIDS", "CORAOPOLIS", "CORDOVA", "CORNELIUS", > > "CORNWALL", "CORONADO", "CORPUS CHRISTI", "CORRY", "COTTAGE HILLS", > > "COTTLEVILLE", "COTTONWOOD", "COVINGTON", "COWEN", "CRANBERRY > > TOWNSHIP", "CROWN POINT", "CUBA", "CUMBERLAND CENTER", "CUMBERLAND > > FORESIDE", "CUMMING", "CUYAHOGA FLS", "CYPRESS", "DALLAS", > > "DALLASTOWN", "DANBURY", "DANIA BCH", "DANVILLE", "DAVENPORT", > > "DAVIE", "DAVIS JUNCTION", "DAWSON", "DAYTON", "DE SOTO", "DECATUR", > > "DEFIANCE", "DEFOREST", "DELAVAN", "DELMAR", "DELRAY BEACH", > > "DEMOTTE", "DENISON", "DENVER", "DEPTFORD", "DERBY", "DERRY", "DES > > MOINES", "DETROIT", "DICKINSON", "DILLSBURG", "DITTMER", "DIXON", > > "DONNA", "DOTHAN", "DOUGLAS", "DOUGLASVILLE", "DOVER", "DOYLESTOWN", > > "DREXEL HILL", "DUBLIN", "DUCHESNE", "DULUTH", "DUNCAN", "DUNCANNON", > > "DUNCANSVILLE", "DUNEDIN", "DUNNSVILLE", "DURHAM", "DUTTON", "EAGLE > > GROVE", "EAST AURORA", "EAST CHICAGO", "EAST EARL", "EAST HANOVER", > > "EAST HARTFORD", "EAST HARTLAND", "EAST LEROY", "EAST LIVERPOOL", > > "EAST MEADOW", "EAST NORTHPORT", "EAST ORANGE", "EAST PEORIA", "EAST > > SAINT LOUIS", "EASTON", "EDGERTON", "EDISON", "EDMOND", "EGG HBR TWP", > > "EL DORADO", "EL PASO", "ELDRIDGE", "ELGIN", "ELIZABETHVILLE", > > "ELLISVILLE", "ELLSWORTH", "ELLWOOD CITY", "ELMHURST", "ELMWOOD PARK", > > "ELOY", "ELY", "EMERSON", "EMORY", "ENDICOTT", "ENGLEWOOD", "ENID", > > "ENNICE", "ENOLA", "ENUMCLAW", "EPHRATA", "ERIE", "ESTERO", "EUREKA > > SPRINGS", "EVANSVILLE", "EVERETT", "EXCELSIOR SPRINGS", "EXTON", > > "FAIRFAX", "FAIRFIELD", "FAIRHAVEN", "FAIRVIEW", "FAIRVIEW PARK", > > "FALMOUTH", "FAR HILLS", "FAR ROCKAWAY", "FARMINGDALE", "FARMINGTON", > > "FAYETTE", "FAYETTEVILLE", "FELTON", "FENTON", "FERGUSON", "FIELDALE", > > "FINDLAY", "FINGERVILLE", "FLEMINGTON", "FLINT", "FLORENCE", > > "FLORESVILLE", "FLORISSANT", "FLOVILLA", "FLOWER MOUND", "FLUSHING", > > "FOGELSVILLE", "FOLSOM", "FONTANELLE", "FOREST HILLS", "FOREST PARK", > > "FORT DODGE", "FORT FAIRFIELD", "FORT GAY", "FORT LAUDERDALE", "FORT > > LEE", "FORT MILL", "FORT MOHAVE", "FORT PAYNE", "FORT PIERCE", "FORT > > SMITH", "FORT WAYNE", "FORT WORTH", "FOSTORIA", "FOUNTAIN INN", > > "FRANKFORT", "FRANKLIN", "FREEDOM", "FREEHOLD", "FREEPORT", "FREMONT", > > "FULLERTON", "FULSHEAR", "FULTON", "GADSDEN", "GAFFNEY", > > "GAINESVILLE", "GALLOWAY", "GARDEN PRAIRIE", "GARDNERS", "GARNETT > > VALLEY", "GARY", "GASTON", "GASTONIA", "GENEVA", "GETTYSBURG", > > "GIBSONIA", "GILBERT", "GIRARD", "GLEN BURNIE", "GLEN CARBON", "GLEN > > COVE", "GLEN MILLS", "GLENSHAW", "GLENVIEW", "GLENWOOD", "GOLDEN > > CITY", "GOLIAD", "GOODSON", "GOODYEAR", "GORHAM", "GOSHEN", > > "GRANBURY", "GRANBY", "GRAND PRAIRIE", "GRAND RAPIDS", "GRANDVIEW", > > "GRANITE CITY", "GRANITE FALLS", "GRANTS PASS", "GRASS VALLEY", > > "GRAVETTE", "GRAYSVILLE", "GREEN LANE", "GREENBRIER", "GREENLAWN", > > "GREENSBORO", "GREENSBURG", "GREENUP", "GREENVILLE", "GREER", > > "GRIFFIN", "GRIFFITH", "GROTON", "GUADALUPE", "GUILFORD", "HADLEY", > > "HAGAN", "HALF WAY", "HALLANDALE BEACH", "HAMBLETON", "HAMBURG", > > "HAMDEN", "HAMILTON", "HAMMOND", "HAMMONTON", "HAMPSHIRE", > > "HAPEVILLE", "HARBORCREEK", "HARLAN", "HARRISBURG", "HARRISON", > > "HARRISONVILLE", "HARTWELL", "HASTINGS", "HATFIELD", "HAVERHILL", > > "HAWK POINT", "HAYESVILLE", "HELEN", "HENDERSON", "HENDERSONVILLE", > > "HENRICO", "HENRIETTA", "HERMITAGE", "HERNDON", "HERSHEY", "HIALEAH", > > "HIAWATHA", "HIBBING", "HICKORY", "HICKORY GROVE", "HIDDENITE", "HIGH > > HILL", "HIGH POINT", "HIGH RIDGE", "HIGHLAND", "HIGHLAND MILLS", > > "HINCKLEY", "HIRAM", "HOBART", "HOLBROOK", "HOLDEN", "HOLDENVILLE", > > "HOLLADAY", "HOLLIS", "HOLLY SPRINGS", "HOLLYWOOD", "HOLTWOOD", > > "HOMER", "HOMESTEAD", "HONEYVILLE", "HOPE MILLS", "HOT SPRINGS", "HOT > > SPRINGS NATIONAL PARK", "HOUSTON", "HUBBARD", "HUDSON", "HUFFMAN", > > "HULL", "HUMANSVILLE", "HUNTERSVILLE", "HUNTINGDON", "HUNTINGTON > > BEACH", "HUNTS POINT", "HURDLE MILLS", "HURRICANE", "HURST", > > "IMPERIAL", "INDEPENDENCE", "INDIAN SHORES", "INDIAN TRAIL", > > "INDIANA", "INDIANAPOLIS", "INDIANOLA", "INMAN", "IOWA CITY", "IRMO", > > "IRVINGTON", "IRWIN", "ISANTI", "ISLESBORO", "ISLIP", "ISSAQUAH", > > "ITHACA", "JACKSBORO", "JACKSON", "JACKSON HTS", "JACKSONVILLE", > > "JAMAICA", "JAMESTOWN", "JASPER", "JEANNETTE", "JEFFERSON", "JEFFERSON > > CITY", "JEWELL", "JOHNSTON", "JOHNSTOWN", "JONESBORO", "JONESPORT", > > "JONESTOWN", "JOPLIN", "JUPITER", "KANKAKEE", "KANNAPOLIS", "KANSAS > > CITY", "KATY", "KEARNEY", "KELLERTON", "KEMAH", "KENMORE", "KENNESAW", > > "KENT", "KINGMAN", "KINGS MOUNTAIN", "KINGSLAND", "KINGSTON", > > "KINGWOOD", "KIRKLAND", "KUTZTOWN", "LA QUINTA", "LA RUE", "LA VERNE", > > "LAFAYETTE", "LAKE BLUFF", "LAKE IN THE HILL", "LAKE ISABELLA", "LAKE > > PLACID", "LAKE SAINT LOUIS", "LAKE TAPPS", "LAKE VILLAGE", "LAKE > > WAUKOMIS", "LAKE WORTH", "LAKEBAY", "LAKELAND", "LAKEWOOD", "LAKEWOOD > > RCH", "LAMBERTVILLE", "LANCASTER", "LANDISVILLE", "LANSDALE", > > "LAREDO", "LARGO", "LAS VEGAS", "LATROBE", "LAUDERHILL", "LAWNDALE", > > "LAWRENCE", "LAWRENCEVILLE", "LE MARS", "LE ROY", "LEAGUE CITY", > > "LEAVENWORTH", "LEAWOOD", "LEBANON", "LECOMPTON", "LEECHBURG", "LEES > > SUMMIT", "LEESBURG", "LEESVILLE", "LEETONIA", "LENEXA", "LENOIR", > > "LEVITTOWN", "LEWES", "LEWISTOWN", "LEXINGTON", "LIBERTY TWP", > > "LILLINGTON", "LINCOLN", "LINDENHURST", "LINTON", "LISBON", > > "LITCHFIELD PK", "LITHIA", "LITITZ", "LITTLE EGG HARBOR TO", "LK > > FOREST PK", "LK PEEKSKILL", "LOCKHART", "LOCKWOOD", "LOGAN", "LOMA > > LINDA", "LONE JACK", "LONG BEACH", "LONG LANE", "LONGVIEW", "LORAIN", > > "LORTON", "LOS ANGELES", "LOUISBURG", "LOVES PARK", "LOWER BURRELL", > > "LOWRY CITY", "LUBBOCK", "LUGOFF", "LUMBERTON", "LYNBROOK", > > "LYNNWOOD", "MACHESNEY PARK", "MACON", "MAGNOLIA", "MAHOPAC", > > "MAHWAH", "MAINEVILLE", "MALVERN", "MALVERNE", "MANASSAS", "MANCHACA", > > "MANCHESTER", "MANCHESTER TOWNSHIP", "MANCHESTER TW", "MANHEIM", > > "MANITO", "MANLIUS", "MANNINGTON", "MANSFIELD", "MANSURA", "MAPLE > > PARK", "MARBLE FALLS", "MARCELLUS", "MARICOPA", "MARIETTA", "MARION", > > "MARKLEYSBURG", "MARS HILL", "MARSHALLTOWN", "MARSHFIELD", > > "MARSHVILLE", "MARTINSVILLE", "MARYSVILLE", "MASON CITY", "MASSEY", > > "MASSILLON", "MASURY", "MATAWAN", "MATEWAN", "MATTAPOISETT", > > "MATTHEWS", "MAYFIELD HTS", "MAYSEL", "MC CLELLAND", "MC DONALD", "MC > > KEES ROCKS", "MC SHERRYSTOWN", "MC VEYTOWN", "MCALESTER", "MCDONOUGH", > > "MCKEESPORT", "MCKINNEY", "MECHANICSBURG", "MECHANICSVILLE", > > "MEDFORD", "MEDIA", "MEDWAY", "MELVILLE", "MEMPHIS", "MERIDEN", > > "MERRIAM", "MERRICK", "MERRILL", "MERRILLVILLE", "MESA", "MESQUITE", > > "MIAMI", "MIAMI GARDENS", "MICHIGAN CITY", "MIDDLETOWN", "MIDLAND", > > "MIFFLINTOWN", "MILFORD", "MILL CREEK", "MILLBROOK", "MILLEDGEVILLE", > > "MILLINOCKET", "MILNER", "MILTON", "MILWAUKEE", "MINEOLA", "MINERAL > > SPGS", "MINERAL WELLS", "MINNEAPOLIS", "MISSION", "MISSION HILLS", > > "MISSION VIEJO", "MISSOURI CITY", "MISSOURI VALLEY", "MOLINE", > > "MONESSEN", "MONROE", "MONROE TOWNSHIP", "MONROEVILLE", "MONTCLAIR", > > "MONTEREY", "MONTICELLO", "MOORESVILLE", "MORGANTON", "MORGANTOWN", > > "MORRIS PLAINS", "MOUND", "MOUND CITY", "MOUNT HOPE", "MOUNT JOY", > > "MOUNT LAUREL", "MOUNT PLEASANT", "MOUNT POCONO", "MOUNT UNION", > > "MOUNT WOLF", "MOUNTVILLE", "MT HOLLY", "MT PLEASANT", "MULVANE", > > "MUNCIE", "MUNSTER", "MURFREESBORO", "MURRAY", "MURRELLS INLT", > > "MUSTANG", "MYERSTOWN", "MYSTIC", "N BRANFORD", "N FT MYERS", > > "NAPERVILLE", "NAPLES", "NAPOLEON", "NASHVILLE", "NATCHITOCHES", > > "NAUGATUCK", "NEOSHO", "NEPTUNE BEACH", "NESCONSET", "NETCONG", "NEW > > BLOOMFIELD", "NEW BRAUNFELS", "NEW BRITAIN", "NEW BRUNSWICK", "NEW > > CASTLE", "NEW CUMBERLAND", "NEW HAVEN", "NEW KENSINGTON", "NEW > > LONDON", "NEW ORLEANS", "NEW PRESTON", "NEW PROVIDENCE", "NEW > > ROCHELLE", "NEW TRIPOLI", "NEW ULM", "NEW WINDSOR", "NEW YORK", > > "NEWARK", "NEWBURGH HEIGHTS", "NEWINGTON", "NEWNAN", "NEWPORT", > > "NEWPORT BEACH", "NEWTON", "NEWTONVILLE", "NIAGARA FALLS", "NIXA", > > "NOANK", "NOKOMIS", "NORCROSS", "NORFOLK", "NORMAN", "NORMANDY PARK", > > "NORTH BABYLON", "NORTH HAVEN", "NORTH HUNTINGDON", "NORTH JACKSON", > > "NORTH LITTLE ROCK", "NORTH MIAMI", "NORTH PORT", "NORTH RICHLAND > > HILLS", "NORTH WALES", "NORTH WATERBORO", "NORTHFIELD", "NORTHRIDGE", > > "NORTON", "NORWALK", "NOTTINGHAM", "NUTLEY", "NYACK", "O FALLON", "OAK > > RIDGE", "OAKDALE", "OCALA", "OCEANSIDE", "OCILLA", "OLATHE", "OMAHA", > > "OMRO", "ONA", "ONALASKA", "OPA LOCKA", "ORADLL", "ORION", "ORONO", > > "ORRINGTON", "OSCEOLA", "OSKALOOSA", "OSSINING", "OSWEGO", "OTTAWA", > > "OVALO", "OVERLAND PARK", "OWASSO", "OWEGO", "OXFORD", "OYSTER BAY", > > "OZARK", "PALERMO", "PALM CITY", "PALM HARBOR", "PALMDALE", "PALMYRA", > > "PALOS HEIGHTS", "PANA", "PAOLA", "PARK RIDGE", "PARLIN", "PARMA", > > "PARRISH", "PARROTT", "PATASKALA", "PAULS VALLEY", "PAXTON", "PEA > > RIDGE", "PEARLAND", "PECULIAR", "PEEKSKILL", "PEKIN", "PELION", > > "PEMBROKE", "PEMBROKE PINES", "PENN YAN", "PENNELLVILLE", "PENNSBURG", > > "PENNSVILLE", "PEORIA", "PERRY", "PERRYOPOLIS", "PERRYSBURG", > > "PERRYVILLE", "PHARR", "PHILADELPHIA", "PHILIPPI", "PHOENIX", > > "PICKENS", "PICKERINGTON", "PIERSON", "PILOT MOUNTAIN", "PINE BLUFF", > > "PINE HILL", "PINEVILLE", "PINNELLAS PARK", "PISCATAWAY", "PITMAN", > > "PITTSBURGH", "PLACIDA", "PLAINFIELD", "PLANO", "PLANT CITY", > > "PLATTEKILL", "PLEASANT HILL", "PLEASANT HOPE", "PLYMOUTH", "POCONO > > LAKE", "POMFRET CENTER", "POMPANO BEACH", "POOLER", "PORT CARBON", > > "PORT CHARLOTTE", "PORT NORRIS", "PORT ORANGE", "PORT SAINT LUCIE", > > "PORT WASHINGTON", "PORTAGE", "PORTER", "PORTERSVILLE", "PORTLAND", > > "POTTSVILLE", "POUGHKEEPSIE", "POWDER SPRINGS", "POWELL", "PRAIRIE > > VILLAGE", "PRESCOTT", "PRESCOTT VALLEY", "PRINCETON", "PROSPECT", "PT > > PLEASANT", "PUNTA GORDA", "PURCHASE", "QUAKERTOWN", "QUEENS VLG", > > "QUINCY", "RALEIGH", "RANDLEMAN", "RANDOLPH", "RAYTOWN", "READING", > > "READLYN", "RED BANK", "RED HOUSE", "RED LION", "REEDERS", "REGO > > PARK", "REHOBOTH BCH", "REIDSVILLE", "RENO", "RENTON", "REPUBLIC", > > "RICH HILL", "RICHARDS", "RICHMOND", "RICHMOND HILL", "RIDGEWOOD", > > "RINCON", "RIO GRANDE CITY", "RIO RANCHO", "RIVERDALE", "RIVERHEAD", > > "RIVERSIDE", "ROANOKE", "ROCHELLE", "ROCHESTER", "ROCK HILL", > > "ROCKAWAY BCH", "ROCKFORD", "ROCKMART", "ROCKY HILL", "ROCKY MOUNT", > > "ROGERS", "ROGERSVILLE", "ROMULUS", "ROOSEVELT", "ROSAMOND", "ROSCOE", > > "ROSENBERG", "ROSENDALE", "ROSWELL", "ROTONDA WEST", "ROUGEMONT", > > "ROXBORO", "ROY", "RUNNELLS", "RURAL HALL", "RUSH VALLEY", "RUSKIN", > > "RUSTBURG", "RUTHER GLEN", "RUTHERFORDTON", "S DEERFIELD", "SACO", > > "SAGINAW", "SAINT AUGUSTINE", "SAINT CHARLES", "SAINT CLAIR", "SAINT > > CLAIRSVILLE", "SAINT LOUIS", "SAINT MARYS", "SAINT MATTHEWS", "SAINT > > PAULS", "SAINT PETERS", "SAINT PETERSBURG", "SALEM", "SALISBURY", > > "SALT LAKE CITY", "SALTSBURG", "SALUNGA", "SAMMAMISH", "SAN ANTONIO", > > "SAN BENITO", "SAN CLEMENTE", "SAN DIEGO", "SAN ELIZARIO", "SAN JUAN", > > "SANDUSKY", "SANDY", "SANFORD", "SANGERVILLE", "SANTA ANA", > > "SARASOTA", "SARATOGA SPRINGS", "SARCOXIE", "SAUGUS", "SAVANNAH", > > "SAYVILLE", "SCALY MOUNTAIN", "SCHAEFFERSTOWN", "SCHULENBURG", > > "SCOTT", "SCOTTSDALE", "SEAFORD", "SEALE", "SEATTLE", "SEDONA", > > "SEGUIN", "SELDEN", "SENECA", "SENOIA", "SEVEN VALLEYS", "SEYMOUR", > > "SHARON", "SHARPSBURG", "SHARPSVILLE", "SHAVANO PARK", "SHAWNEE", > > "SHELLSBURG", "SHELTON", "SHENANDOAH", "SHORELINE", "SHOREWOOD", > > "SHREVEPORT", "SICKLERVILLE", "SILER CITY", "SILOAM SPRINGS", "SIMON", > > "SIMPSONVILLE", "SIMSBURY", "SIOUX CITY", "SIOUX FALLS", "SKOKIE", > > "SKOWHEGAN", "SLATINGTON", "SLIDELL", "SMITHFIELD", "SN BERNRDNO", > > "SNELLVILLE", "SOCORRO", "SOMERS", "SOPHIA", "SOUTH AMBOY", "SOUTH > > BELOIT", "SOUTH BEND", "SOUTH DARTMOUTH", "SOUTH HOUSTON", "SOUTH > > PARK", "SOUTH PLAINFIELD", "SOUTH SIOUX CITY", "SOUTHAMPTON", > > "SOUTHBURY", "SOUTHGATE", "SPARKS", "SPARROW BUSH", "SPENCER", > > "SPRING", "SPRING BRANCH", "SPRING GROVE", "SPRING HILL", "SPRING > > HOPE", "SPRING VALLEY", "SPRINGDALE", "SPRINGFIELD", "SPRINGFIELD > > GARDENS", "SPRINGHILL", "SPRINGTOWN", "SPRNGFLD GDNS", "SPRUCE PINE", > > "ST PETERSBURG", "ST. GEORGE", "STAFFORD", "STAMFORD", "STANDISH", > > "STANLEY", "STANTON", "STATEN ISLAND", "STATESVILLE", "STERLING", > > "STILLMAN VALLEY", "STILWELL", "STOCKBRIDGE", "STOCKTON", "STONE MTN", > > "STRAFFORD", "STRATFORD", "STRONGSVILLE", "STROUDSBURG", "STRUTHERS", > > "SUFFIELD", "SUGAR HILL", "SUGAR LAND", "SULPHUR", "SUMMERVILLE", > > "SUMMIT", "SUN CITY", "SUNBURY", "SUWANEE", "SWANSEA", "SWANTON", > > "SWEENY", "SWISSVALE", "SYCAMORE", "SYLVANIA", "SYRACUSE", "TACOMA", > > "TAFTVILLE", "TAMPA", "TAPPAHANNOCK", "TAR HEEL", "TAUNTON", > > "TAYLORVILLE", "TECUMSEH", "THE WOODLANDS", "THEODOSIA", "THOMASTON", > > "THOMASVILLE", "TIERRA VERDE", "TIFTON", "TILLSON", "TILTON", "TINLEY > > PARK", "TOCCOA", "TOLEDO", "TOLLAND", "TOMBALL", "TOMS RIVER", > > "TOPEKA", "TOPSHAM", "TORRINGTON", "TOVEY", "TOWNSEND", "TRAVELERS > > RST", "TRENT", "TRINITY", "TROUTMAN", "TROY", "TRUMBULL", "TUCKER", > > "TULALIP", "TURNER", "TUSCUMBIA", "TYRONE", "UNION", "UNION CITY", > > "UNIVERSAL CTY", "UNIVERSITY HTS", "UPPR CHICHSTR", "URBANA", > > "URBANDALE", "UTICA", "VAIL", "VALE", "VALENCIA", "VALPARAISO", "VAN > > BUREN", "VAN METER", "VAN WERT", "VANDERGRIFT", "VASSALBORO", > > "VAUGHN", "VENICE", "VERNAL", "VERNON", "VERONA", "VICTOR", "VIDALIA", > > "VIENNA", "VILLA GROVE", "VILLA RIDGE", "VOLANT", "W HAMPTON BCH", "W > > TERRE HAUTE", "WADSWORTH", "WAHOO", "WAKE FOREST", "WALDEN", > > "WALLINGFORD", "WALLINGTON", "WALNUT COVE", "WANAQUE", "WARFORDSBURG", > > "WARMINSTER", "WARREN", "WARSAW", "WARTHEN", "WASHINGTON", "WASOLA", > > "WATAUGA", "WATERBURY", "WATERFORD", "WATERLOO", "WATERVILLE", > > "WATKINS GLEN", "WAXAHACHIE", "WAYCROSS", "WAYNESBORO", "WEBSTER", > > "WEIRTON", "WELLSBORO", "WELLSVILLE", "WENTZVILLE", "WESLACO", "WEST > > CHESTER", "WEST DEPTFORD", "WEST DES MOINES", "WEST HAVEN", "WEST > > HICKORY", "WEST LIBERTY", "WEST MIFFLIN", "WEST PALM BEACH", "WEST > > POINT", "WEST READING", "WEST SENECA", "WEST SUFFIELD", "WEST VALLEY > > CITY", "WESTERVILLE", "WESTHAMPTON", "WESTMINSTER", "WESTMORELAND > > CITY", "WESTPORT", "WESTVILLE", "WETHERSFIELD", "WHARTON", "WHEELING", > > "WHITE PLAINS", "WHITEHALL", "WHITESTONE", "WHITESTOWN", "WHITING", > > "WHITMAN", "WHITTIER", "WICHITA", "WILDWOOD", "WILLARD", > > "WILLIAMSBURG", "WILLIAMSPORT", "WILLOW GROVE", "WILLOWBROOK", > > "WILLOWICK", "WILMETTE", "WILMINGTON", "WILSON", "WILTON MANORS", > > "WIMBERLEY", "WINDCREST", "WINDER", "WINNEBAGO", "WINSIDE", "WINSTON", > > "WINSTON SALEM", "WINTERSET", "WINTHROP", "WOLCOTT", "WOODBRIDGE", > > "WOODBURY HEIGHTS", "WOODLAND PARK", "WOODLAWN", "WOODS CROSS", > > "WOODSIDE", "WOODSTOCK", "WORTHINGTON", "WYOMISSING", "YARMOUTH", > > "YOE", "YONKERS", "YORK", "YORKTOWN", "YORKTOWN HEIGHTS", "YOUNG HARRIS", "YOUNGSTOWN", "YPSILANTI", "ZELIENOPLE", "ZEPHYRHILLS"), class = "factor"), > > clusters = c(6L, 10L, 3L, 10L, 5L, 6L, 10L, 6L, 6L, 7L, 5L, > > 7L, 8L, 8L, 3L, 6L, 3L, 10L, 7L, 10L, 10L, 4L, 2L, 8L, 9L, > > 1L, 4L, 4L, 7L, 5L, 10L, 5L, 5L, 10L, 6L, 6L, 10L, 6L, 7L, > > 10L, 10L, 3L, 3L, 6L, 3L), Longitude = c(-93.883554, -90.582058, > > -83.868923, -89.544083, -72.902467, -94.458904, -90.588533, > > -94.527843, -92.93769, -80.029456, -70.58809, -82.888789, > > -80.113071, -82.6661, -81.372992, -95.840964, -82.016013, > > -89.92625, -80.276676, -89.778385, -87.641063, -94.888036, > > -117.663119, -82.530568, -75.574437, -122.209047, -96.799309, > > -95.746255, -80.553953, -73.923314, -87.713482, -73.9731, > > -73.8187, -87.987023, -93.759478, -94.110903, -90.00597, > > -93.257109, -79.932483, -90.201858, -89.100233, -84.625923, > > -84.567614, -93.912921, -84.612564), Latitude = c(34.503045, > > 38.752515, 33.406527, 40.893588, 41.733088, 38.999032, 41.657674, > > 38.890929, 37.639766, 42.099693, 43.53462, 40.142492, 26.538149, > > 27.9062, 31.90104, 34.833083, 35.118836, 35.136047, 39.425712, > > 40.519207, 40.101126, 30.044457, 33.62287, 27.910276, 39.752254, > > 47.403778, 32.961929, 29.820199, 38.408649, 40.668828, 41.983948, > > 40.58116, 40.7253, 41.921667, 41.669921, 36.442552, 38.564663, > > 37.455315, 40.867774, 38.783554, 42.244381, 34.024332, 34.001644, > > 36.622704, 34.017832), distances_Me = c(1879089.079, 1437296.523, > > 1185638.742, 1313997.97, 156759.9125, 1759443.351, 1398398.997, > > 1767861.917, 1668917.322, 534234.2576, 431749.2965, 758508.4701, > > 1657031.938, 1615575.668, 1169085.702, 2024642.021, 930944.4681, > > 1525322.746, 553069.7532, 1337002.822, 1161367.37, 2223496.376, > > 3918520.212, 1609088.602, 164252.5146, 3878581.001, 2197910.688, > > 2304526.789, 614908.3151, 11075.24597, 1160375.454, 494.2997496, > > 21063.72622, 1182681.434, 1662351.873, 1810881.911, 1393581.436, > > 1701982.013, 504395.772, 1404348.991, 1276505.454, 1190457.718, > > 1188029.899, 1787261.336, 1189994.055), distances_Mi = c(1167.607468, > > 893.0913246, 736.719012, 816.477441, 97.40573055, 1093.263337, > > 868.9216123, 1098.494372, 1037.01328, 331.9565399, 268.2755749, > > 471.3135552, 1029.628072, 1003.868436, 726.4334682, 1258.049536, > > 578.4599174, 947.7880794, 343.6603307, 830.7719404, 721.6375366, > > 1381.611443, 2434.846498, 999.8375755, 102.0614003, 2410.029515, > > 1365.713293, 1431.96122, 382.0848884, 6.881813138, 721.0211909, > > 0.30714248, 13.08834388, 734.8814328, 1032.933715, 1125.225657, > > 865.9281298, 1057.55865, 313.4158337, 872.6187534, 793.1807589, > > 739.7133739, 738.2048023, 1110.548567, 739.4252678), ID > > 2308:2352), row.names = c(NA, -45L), class = "data.frame") > > > > Proprietary > > > > NOTICE TO RECIPIENT OF INFORMATION:\ This e-mail may > > con...{{dropped:16}} > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mail > > man_listinfo_r-2Dhelp&d=DwIBaQ&c=wluqKIiwffOpZ6k5sqMWMBOn0vyYnlulRJmmv > > OXCFpM&r=j7MrcIQm2xjHa8v-2mTpmTCtKvneM2ExlYvnUWbsByY&m=sRhKIDOv4AuwrfD > > BU9b2Rpj-VPfs0lcpkQqNBfVLSe4&s=CloI44kowc5J_mOah6vx_Kl4PFIeqxmwexvRiqw > > xuOA&e= PLEASE do read the posting guide > > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.or > > g_posting-2Dguide.html&d=DwIBaQ&c=wluqKIiwffOpZ6k5sqMWMBOn0vyYnlulRJmm > > vOXCFpM&r=j7MrcIQm2xjHa8v-2mTpmTCtKvneM2ExlYvnUWbsByY&m=sRhKIDOv4Auwrf > > DBU9b2Rpj-VPfs0lcpkQqNBfVLSe4&s=iOWreiJDomXv-uJ3NzQNX0IUsupILo_4DmkFK3 > > GRUig&e= and provide commented, minimal, self-contained, reproducible > > code. > > NOTICE TO RECIPIENT OF INFORMATION: > This e-mail may contain confidential or privileged information. If you think you have received this e-mail in error, please advise the sender by reply e-mail and then delete this e-mail immediately. > This e-mail may also contain protected health information (PHI) with information about sensitive medical conditions, including, but not limited to, treatment for substance use disorders, behavioral health, HIV/AIDS, or pregnancy. This type of information may be protected by various federal and/or state laws which prohibit any further disclosure without the express written consent of the person to whom it pertains or as otherwise permitted by law. Any unauthorized further disclosure may be considered a violation of federal and/or state law. A general authorization for the release of medical or other information may NOT be sufficient consent for release of this type of information. > Thank you. Aetna