[R] Procedure not working for actual data

2010-02-17 Thread LCOG1
Hello all, I have what i feel is a unique situation which may not be resolved with this inquiry. I have constructed the below data set so that i may give an example of what im doing. The example works perfectly and i have no issues with it. My problem arises with my actual data, which inclu

[R] Subtracting one based on an If

2010-02-18 Thread LCOG1
For the following: Bldgid<-c(1000,1000,1000,1001,1002,1003,1003,1003) Maplot<-c(2,20001,20002,3,30001,4,40001,40002) Area<-c(40,170,160,50,100,100,90,110) #Construct Sample dataframe MultiLotBldgs..<-data.frame(Bldgid,Maplot,Area) CondoLots_ <- tapply(MultiLotBldgs..$Maplot, Mul

[R] matching on two criteria

2010-02-22 Thread LCOG1
Howdy y'all, I am looking to use the match function to match a data attribute to another data frame but i need it to do so on two criteria to ensure an appropriate match. The following matches incorrectly. I know the example looks pointless but its just an example. Perhaps there is another wa

[R] select row based on highest value

2010-02-23 Thread LCOG1
Please consider the following #Data to use Props<-c("p754921","p754921" ,"p754921","p75506" ,"p75506" ,"p75506","p75506","p75508","p75508","p75508","p75508","p75508") TAZ<-c(38,37,37,171,171,282,171,46,46,169,169,169) Area<-c(109828.04, 128134.71, 46469.57, 37160.21, 40080.50,344679.66

Re: [R] select row based on highest value

2010-02-23 Thread LCOG1
x27; dataframe and therefore you are indexing to the incorrect value. Best to split the dataframe and then operate on the individual portions. On Tue, Feb 23, 2010 at 3:47 PM, LCOG1 <[hidden email]<http://n4.nabble.com/user/SendEmail.jtp?type=node&node=1566613&i=0>> wrote: >

[R] Removing colon from numerical data

2010-03-04 Thread LCOG1
Basic question, looked through the forum and documentation but didnt see a solution. So consider O<-c(1:20) D<-c("1:","2:","3:","4:","5:","6:","7:","8:","9:","10:","11:","12:","13:","14:","15:","16:", "17:","18:","19:","20:") Time<-c(51:70) AveTT<-data.frame(O,D,Time) I would like to remove

[R] trouble getting multinimial logit model to work properly

2010-03-10 Thread LCOG1
Greetings all, please consider the following data: #Build Data frame Slope<-c(1.291370, 12.208500, 2.110930, 0.578990, 5.019520, 0.807444, 0.554079 , 1.257080, 0.241504 , 0.184337 , 0.383044 , 0.342021) Exposure<-c(790.54, 1167.79 , 845.58 , 1082.47 , 1189.61 , 677.17 , 2058.56 , 469.09

[R] Setting breaks to data more appropriately

2010-03-22 Thread LCOG1
Basic question. For the below data, i would like to but each of the values in a bin that represents their value. So the below would hopefully put .1 in the 0-.1 bin, .2 in the .11-.2 bin and so forth. The outlying values would then be put into and outer category representing everything >1. Im

[R] swutching rows to columns

2010-03-22 Thread LCOG1
Hi All, Consider the following: TRN<-c(5.809657,3.1, 1.774901e-02) TRN_CLUST<-c(-4.174682e-05, 5.538742e-05,1.2) EmpCo<-data.frame(TRN,TRN_CLUST) row.names(EmpCo)<-c("Slope","Fwy","Univ") returns: TRN TRN_CLUST Slope 5.80965700 -4.174682e-05 Fwy 3.1000 5.538742e-05 Un

[R] Getting choropleth map intervals correct

2010-03-23 Thread LCOG1
Hello all, Working on mapping some probabilities using R to a geographic unit called a TAZ.The below data will work but you will have to set your directory for the shape file. Never did this before so hopefully this works. ResProbs is just supposed to be a value between 0-1, sorry if that m

[R] Automating searching text for key words

2010-04-15 Thread LCOG1
Hello all, Im doing some content analysis of news stories and i am looking for a way to sort through different text lists searching for specified words then storing the results, at this point just the count. Heres what i have so far: #Load data frame of wed address to load ->Creates raw wor

[R] Drop last numeral

2010-01-12 Thread LCOG1
Hello all, Frustrated and i know you can help I need to drop the last numeral of each of my values in my data set. So for the following i have tried the ?substring but since i have to specify the length, but because my data are of varying lengths it doenst work so well Data<-c("1131", "1132

Re: [R] Drop last numeral

2010-01-12 Thread LCOG1
The Below worked best for my purposes. Thanks everyone. Data<-c("1131", "1132", "1731" ,"1732" ,"1821" ,"1822", "2221" ,"", "2241" ,"2242","414342" ,"414371" ,"41

[R] Create a multi dimensional array from a data frame

2010-01-21 Thread LCOG1
Hello all, I have data from a csv that i need to coerce into a multi dimensional array. As you can see from my sample code i have yet to master building efficient code. I can sort of do what i want but its very cumbersome code and i know there is a better way to do it, i am just not experein

[R] Issue using tapply

2010-01-25 Thread LCOG1
Hello all, I am trying to use the tapply function to sum some values and change the column names of the resulting vector. I input Emp Et 1 10565 ACC 2 7515 ADM 3625 AGF 4 6243 CNS 5 12721 EDU 6 3924 FIN 7 18140 HLH 8 3686 INF 9 15841 MFG 10 243 MIN 11 1864 MNG 12

Re: [R] Issue using tapply

2010-01-25 Thread LCOG1
Ista you have suggested the correct solution, i didnt htink it would matter not having that value but it did. Things work as they should now, thankyou -- View this message in context: http://n4.nabble.com/Issue-using-tapply-tp1289681p1289764.html Sent from the R help mailing list archive at Nabb

[R] Selecting single TAZ based on area proportion

2010-02-08 Thread LCOG1
Good day all, I am having an issue coercing my data. Below i have some data on taxlots and an associated TAZ(transportation analsysi zone) that each property is within. The main issue is that some properties cross TAZ boundaries so i need to make a decision as to which TAZ the property belon

[R] Sorting a data frame by specifying a vector

2012-10-11 Thread LCOG1
Hello all, I cannot seem to figure out this seemingly simple procedure. I want to sort a data frame by a specified character vector. So for : df.. <- data.frame(Season=rep(c("Summer","Fall","Winter","Spring"),4),Obs= runif(length(rep(c("Summer","Fall","Winter","Spring"),4 I want to so

[R] Coerce rownames to factor for ordering

2012-11-29 Thread LCOG1
Hi all, I think this might be an easy one but I cannot think of a way to do this other than what I am currently attempting. I simply want to sort my data frame's rownames by a defined vector so that the plots I generate from that vector are in the desired order Consider the test data below:

[R] Transforming character vector

2010-09-13 Thread LCOG1
Hi guys, Cant seem to find a solution for this. I am looking for a substitute for cut that can transform character vectors. So as cut would be used below to transform YearCat-> YearCat2 base on Year and vector Ag<-c("00-'70","'71-'75","'76-'85","'86-'09") using 'cut ' FleetData$YearCat<-cut(F

[R] proportion

2010-09-13 Thread LCOG1
Hi , SO i have been on a role of asking simple questions lately. So much for feeling like im getting this R business. I wrote a script 2 weeks ago that utilized "proportion" to turn values in a table (from "table") into proportions to then graph. I now get an error that proportion is not a

[R] Cut including the 0 value as separate bin

2010-10-26 Thread LCOG1
Hi everyone, I have been using R too long to have to ask this but here i am. How do i create a separate bin for the 0 value? So for: #Create data frame DF<-data.frame(A=0:20) #Create label vector labs<-1:6 #Create buckets and label DF$Cut<-cut(DF$A,c(0,4,8,12,14,16,20),labels=labs,include.l

[R] Alter character attribute

2010-10-28 Thread LCOG1
Hi everyone I have some records that include a date attribute for the date and time but i need to separate the data and analyze it separately in GIS by Month and Year, so i need to pull these attributes out and create their own attribute field. So the input: RawData2.. returns ID period_e

Re: [R] Alter character attribute

2010-10-28 Thread LCOG1
Changing the filed into date format then pulling out the month/year worked best. Thanks, i knew it was gonna be easy. Cheers -- View this message in context: http://r.789695.n4.nabble.com/Alter-character-attribute-tp3018202p3018255.html Sent from the R help mailing list archive at Nabble.com.

[R] Aggregate on identical link attributes

2010-11-15 Thread LCOG1
Hello R community, I need to do some aggregation based on the test data below. The below code works ok, but when its applied to my real data which includes over 9,000 records the process runs for over an hour. I know there is a more efficient way of doing this. I want to Sum the below data'

Re: [R] Aggregate on identical link attributes

2010-11-16 Thread LCOG1
Okay here is a solution that works in less than 60 minutes but i feel likes its messy, if anyone has an alternative solution i would very much appreciate your insights. #Create test data TNode<-c(1:20,21) FNode<-c(rev(1:20),22) Volume<-c(rep(100,20),200) ClassCode=c(rep("Local",20),rep("Freeway

[R] List elements of NULL to value

2010-11-29 Thread LCOG1
Hi everyone, I am posting this because i know its easy and i cant for the life of me figure out how to do it though i have tried and through a ridiculously complex loop made it happen. I need to convert some list elements of NULL value to 0s so they mesh with my data frame properly. So for

[R] Dont show zero values in line graph

2011-01-06 Thread LCOG1
Hey everyone, Im getting better at plotting my data but cant for the life of me figure out how to show a line graph with missing data that doesnt continue the line down to zero then back up to the remaining values. Consider the following x<-c(1:5,0,0,8:10) y<-1:10 plot(0,0,xlim=c(0,10), ylim

[R] Plotting multiple layers(maps) on same page

2010-08-03 Thread LCOG1
Hey guys and gals, I searched through the forum and a bunch of R-mapping dedicated sites but have not found what i know is quite elementary process, mapping more than one layer on the same plot. I need to show some reference lines for the map to make sense. I know the below wont work for anyo

Re: [R] Plotting multiple layers(maps) on same page

2010-08-03 Thread LCOG1
I have done graphs but im trying to figure out how to map multiple shape files onto the same R plot and eventually export to pdf. Does this somehow apply and im missing the transfer? From: Wu Gong [via R] [mailto:ml-node+2312414-731348129-103...@n4.nabble.com] S

[R] Pie Chart in map

2010-08-09 Thread LCOG1
Hey R'rs, So im sick of dealing with ESRI products and am looking to stream line a process i now use GIS to do using R. I have made a lot of maps using R but have not yet seen a map that puts pie charts within the map to help represent data like the attachment. http://r.789695.n4.nabble.com

[R] Plotting multiple histograms on same panel

2010-08-23 Thread LCOG1
Hey everyone, So i cant figure this out. when using histogram() from lattice instead of hist() i get what i want as far as output. But using histogram i can seem to be able to figure out how to get multiple plots on the same panel. So par(mfrow=c(3,2)) for (i in 1:20) hist(rnorm(100),ma

[R] readShapeSpatial error with 2.11.1

2010-09-08 Thread LCOG1
Anyone encounter an issue with using the readShapeSpatial function from maptools in the latest version of R. I get a simple "Error in read.dbf(filen) : unable to open DBF file" but when i run the exact scrip in 2.10.0 the script produces the map just fine. Sorry for no code but i figured this ma

[R] Summarize by two or more attributes

2011-05-17 Thread LCOG1
Okay everyone heres a likely softball for someone. Consider the following data frame: #Create data x<-rep(c(1,15),10) y<-rnorm(20) z<-c(rep("auto",10),rep("bus",10)) a<-rep(c(1,1,2,2,3,3,4,4,5,5),2) #Create Data frame Df<-data.frame(Source=x,Rate=y,Bin=a,Type=z) I want to create a new column th

Re: [R] Summarize by two or more attributes

2011-05-17 Thread LCOG1
I will hit my own ball on this one tapply(Df$Rate,list(Df$Bin,Df$Type),sum) -- View this message in context: http://r.789695.n4.nabble.com/Summarize-by-two-or-more-attributes-tp3529825p3530034.html Sent from the R help mailing list archive at Nabble.com. ___

[R] Data frame manipulation

2010-05-27 Thread LCOG1
Hello All, Please consider the following: TotEmp<-c(19,6,1,1,8,44,2,33,48,1) ClusterType<-c("AGF","CNS","OSV","RTL","RTL","TRN","REL","ACC_CLUST","RTL","WHL") Taz<-c(0,0,0,100,100,100,101,101,102,103) AllCtTypes_<-c("AGF","CNS","OSV","RTL","TRN","REL","ACC_CLUST","WHL","ADM_CLUST", "HLH","HLH_C

Re: [R] Data frame manipulation

2010-05-28 Thread LCOG1
www.r-statistics.com (English) -- On Fri, May 28, 2010 at 3:14 AM, LCOG1 <[hidden email]> wrote: > > Hello All, > Please consider the following: > > TotEmp<-c(19,6,1,1,8,44,2,33

[R] Subsetting for unwanted values

2010-06-03 Thread LCOG1
Hi all, I have toyed with this for too long today and in the past i used multiple lines of code to get at what i want. Consider the following: All i need to do is subset Pc to the values that do not equal Pc.X. The first attempt doesnt work because i have unequal lengths. The second attemp

[R] Transforming list to data frame with corresponding columns

2010-06-07 Thread LCOG1
Hi all, Consider the following. a<-list(c("MHsub","MHsub","SFD","Duplex")) b<-list(c("MHsub","MHsub","SFD")) c<-list(c("MHpark","SFD","SFD")) d<-list(c("MultiFam","MultiFam","MultiFam","Duplex")) all<-list(a,b,c,d) names(all)<-c("5","6","7","8") all2<-list() for(i in 1:length(all)){ all2[[i

Re: [R] Transforming list to data frame with corresponding columns

2010-06-07 Thread LCOG1
ind, lapply(all2, '[', nm <- unique(unlist(sapply(all2, names), nm) On Mon, Jun 7, 2010 at 4:20 PM, LCOG1 <[hidden email]> wrote: > > Hi all, > Consider the following. > > > a<-list(c("MHsub","MHsub","SFD","Duplex

[R] rJava software

2011-03-16 Thread LCOG1
Hey everyone, I just saw a demonstration of a model that is built entirely in R that allows for transportation greenhouse gas related scenario testing and it used an awesome GUI utilizing iplots, rJava and gWidgets libraries. Very cool stuff. I am a somewhat seasoned R user but cannot seem to

[R] Loading mdb

2011-03-22 Thread LCOG1
Well im thoroughly frustrated after 25 minutes of checking and rechecking my path. What do i not know about loading a mdb that is keeping me from loading my data. i have loaded the Hmisc library and pointed it too my data using mdb.get and continue to get the following error. Error in system(

[R] Oh apply functions, how you confuse me

2011-09-01 Thread LCOG1
Hi guys, I have a crap load of data to parse and have enjoyed creating a script that takes this data and creates a number of useful graphics for our area. I am unable to figure out one summary though and its all cause I dont fully understand the apply family of functions. Consider the following:

[R] Probably a good use for apply

2012-05-30 Thread LCOG1
Hi all, I Have a data frame test.. that I would like to convert into a list below test_ but am unsure how to efficiently do this. I can do it in a for loop but my data set is huge and it takes forever. Wondering how I can do this more efficiently. So again how to I go from test.. to test_ bel

Re: [R] Probably a good use for apply

2012-05-31 Thread LCOG1
This is great thank you. I think I am getting the hang of some of the apply functions. I am stuck again however. I have list test_ below and would like to apply the sample function using each element of each vector as the probability and return a TRUE or FALSE that I will ultimately sum the TRUE

[R] Using object as literal value in list vector

2012-06-20 Thread LCOG1
Hello all , This is a pretty simple question I think but cannot find an answer on the list or in my brain. I would like to iterate through a loop and use a vector of strings to name a number of list elements. For instance #Create vector of strings Et<- c("ACC","RTL","WHL")

[R] lattice histogram log and non log values

2012-06-27 Thread LCOG1
Hello all, Please consider the following library(lattice) Colors. <-rep(brewer.pal(7, "Dark2"),2) color <- 1 Data.X.. <- data.frame(UnitArea = c(rnorm(1000), rnorm(1000)), Type = c(rep("Base",1000),rep("Log",1000))) histogram( ~ UnitArea | Type, data =

[R] Appending to list

2011-06-22 Thread LCOG1
So im here now b/c im incredibly frustrated. Please consider the following: #Try 1 Data_<-list() Sn<-1:12 for(sn in Sn){ for(i in 1:10){ Data.X <- rnorm(100,0,10) Data_[[paste(sn,i,sep="-")]]<-Data.X } } ##Try 2 Data_<-list() Sn<-1:12 for(sn

[R] add leading zeros

2012-07-26 Thread LCOG1
Hi all, Trying to use an apply to add leading zeros to a set of values in a given vector. I only want to add enough zeros so that the total number of characters is 5, so if I have an element "1" i want "1" or "9000" I want "09000". I tried vec <- 1:1000 sapply(vec, FUN = sprintf(paste

[R] Summarizing elements of a list

2011-12-01 Thread LCOG1
Hi everyone, I looked around the list for a while but couldn't find a solution to my problem. I am storing some results to a simulation in a list and for each element i have two separate vectors(is that what they are called, correct my vocab if necessary). See below Version1_<-list() for(i in

Re: [R] Summarizing elements of a list

2011-12-02 Thread LCOG1
:17 PM, LCOG1 <[hidden email]> wrote: > Hi everyone, > I looked around the list for a while but couldn't find a solution to my > problem. I am storing some results to a simulation in a list and for each > element i have two separate vectors(is that what they are called

Re: [R] Summarizing elements of a list

2011-12-02 Thread LCOG1
ook like. > > Thanks for the reproducible example. > > Sarah > > On Thu, Dec 1, 2011 at 5:17 PM, LCOG1 <[hidden > email]> wrote: >> Hi everyone, >> I looked around the list for a while but couldn't find a solution to my >> problem. I am storing some results

[R] To Try or to TryCatch, I have tried to long

2011-12-06 Thread LCOG1
So after about 4 hours struggling with Try and TryCatch I am throwing in the towel. I have a more complicated function that used logspline through iterative distributions and at some point the logspline doesnt function correctly for some subsets but is fine with others so I need to be able to iden

[R] More issues with apply

2012-01-13 Thread LCOG1
Hi all, Please consider the following: DataSet1.. <- data.frame(Bldgtype=c("SFDM","SFDM","SFDM","SFDM","SFDM","SFDM","APT"), Taz=c("254","254","254","564","564","564","564"),stringsAsFactors = FALSE) PeriodResType_Zx <- tapply(as.character(DataSet1..$Bldgtype), as.character(DataSet1..$Taz),

Re: [R] More issues with apply

2012-01-15 Thread LCOG1
Sorry I wasn't completely clear, I am not 100% sure I know all the terminology but what I want the array to store is both 'Taz' with the 'Bldgtype' count designations like the result from data set one returns. When there isn't more than one type of 'Bldgtype' like in data set 2 the 'Bldgtype' desi

[R] I bet apply has a solution

2012-02-06 Thread LCOG1
Hi all For the data below, I would like to return a logical value indicating differences in the data. #Create data Data..<-data.frame(a=rep(1,10),b=c(rep(1,9),2),c=c(rep(1,8),2,2)) a b c 1 1 1 1 2 1 1 1 3 1 1 1 4 1 1 1 5 1 1 1 6 1 1 1 7 1 1 1 8 1 1 1 9 1 1 2 10 1 2 2 So what I want