Error In Storage.modetest - Logical
sorted by: [ date ] [ thread ] [ subject ] [ author ] An embedded and charset-unspecified text was scrubbed... Name: not available URL:
There, I get the following error from the code pasted below: Error in storage.mode(test) <- "logical" : object 'HGBmt12_Natl_Ave_or_Facility' not found library(RODBC) library(car) setwd("c://temp//cms") a07.connect <- odbcConnectAccess2007("DFC.accdb") sqlTables(a07.connect) ##provides list of tables## dataset <- sqlFetch(a07.connect,'Analysis File 2007-2009') #puts dfc data into table mydata str(dataset) #this works and https://stat.ethz.ch/pipermail/r-help/2010-July/245402.html gives correct values HGlt102009=dataset[,6] HGBL10_F_2007 =dataset[,11] HGmt122009=dataset[,7] HGBL12_F_2007 = dataset[,16] URRmt65Perc2009 = dataset[,3] URRG65_F_2007=dataset[,22] yes1=HGlt102009-HGBL10_F_2007 no1=HGlt102009-2 yes2=HGmt122009-HGBL12_F_2007 no2=HGmt122009-26 yes3=URRG65_F_2007-URRmt65Perc2009 no3=96-URRmt65Perc2009 Analysis2009 <- transform(dataset , HGBlt10_Natl_Ave_or_Facility = recode(HGBL10_F_2007,"0:2='National'; else='Facility'") , HGBmt12_Natl_Ave_or_Facility = recode(HGBL12_F_2007,"0:26='National'; else='Facility'") , URRmt65_Natl_Ave_or_Facility = recode(URRG65_F_2007,"96:100='National'; else='Facility'") , HGlt10RawPerc = ifelse(HGBlt10_Natl_Ave_or_Facility http://tolstoy.newcastle.edu.au/R/e11/help/10/07/1072.html == "Facility",yes1,no1) , HGmt12RawPerc = ifelse(HGBmt12_Natl_Ave_or_Facility == "Facility",yes2,no2) , URRmt65Perc = ifelse(URRmt65_Natl_Ave_or_Facility == "Facility",yes3,no3) , HGBlt10Points<-recode(HGlt10RawPerc ,"-1001:0=10; 0:1=8; 1:2=6; 2:3=4; 3:4=2; else=0 ") , HGBlt12Points<-recode(HGlt12RawPerc ,"-1001:2=6; 2:3=4; 3:4=2; else=0 ") , URRmt65Points<-recode(HGlt10RawPerc ,"-1001:0=10; 0:1=8; 1:2=6; 2:3=4; 3:4=2; else=0 ") ) Any ideas on what it means and why? I'd really appreciate it!! Thank you!! Sincerely, tom [[alternative HTML version deleted]] R-help_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 12 Jul 2010 - 18:40:03 GMT This message: [ Message body ] Next message: Joshua Wiley: "Re: [R] in continuation with the earlier R puzzle" Previous message: Stefan Grosse: "Re: [R] How to create sequence in month" Contemporary messages sorted: [ by date ] [
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About http://stackoverflow.com/questions/24517589/error-referencing-shape-file-data-table-xdata-in-nested-loop-plot-if-els Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error, referencing shape file data error in table (x@data) in nested loop, plot(), if else, dataframe up vote 0 down vote favorite Update: adding an example. The shapefile destination and read directories just need to be pointed towards a particular user. Thanks for any comments. a<-rep("Baker",10) b<-rep("Columbia",10) m<-factor(data<-c(1,1,1,1,1,2,2,2,2,2)) n<-m e<-sample(c(runif(10,min=0,max=1))) f<-sample(c(runif(10,min=0,max=3))) g<-c(a,b) h<-c(m,n) i<-c(e,f) t5<-data.frame(g,h,i) colnames(t5)<-c("Regions_RR","Name","Value") url2<-"http://navigator.state.or.us/sdl/data/shapefile/k24/orcnty24.zip" work.dir<-"c:/Users/.../Downloads" file1<-basename(url2) download.file(url2,file1) unzip(file1,exdir=work.dir) require(rgdal) s<-readOGR("C:/Users/.../Downloads",layer="orcnty24") summary(s) s@data$altName I want to create multi-panel plots, which consist error in storage.modetest of a column of panels in which are plotted shapefiles and a second column of panels in which are plotted data, corresponding to a single region polygon in the shapefile. Each row represents a different region, so I want to color a single ploygon in each plot. I can't get the syntax right for the plot statement for the shapefile. My latest attempt is below, using d_ply() in the col= statement. That generates an "error in evaluating the argument 'x' in selecting a method for function 'plot' If what I'm asking doesn't come across I can provide some example data, but maybe there is a simple solution. Am I going about this the wrong way? Do I need to convert the shapefile attribute table to some other object? Thanks for any comments. s= polygon shapefile s@data = shapefile attribute table t5= dataframe plot.new() #open plot par(mfrow=c(2,3)) par(cex=0.6) par(mar=c(3,3,0,0),oma=c(1,1,1,1)) par(tcl=-0.25) d_ply(t5,"Regions_RR",function(y) { #cycle through df by region for (i in 1:4) { #cycle through panels if (i %in% c(1,3)) #plot shapefiles in panels 1 & 3 plot(s, col=ifelse(d_ply(as.data.frame(s@data),"altName", function (z) { z=y}),1,0)) if (i %in% c(2,4)) #plot data in panels 2 & 4 d_ply(t5,"Name",function(x) { plot