[R] How to obtain a cross tab count of unique values

2015-03-31 Thread Walter Anderson
of unique parks for each project. If I using the standard table(df$PROJECT) it reports: A 3 B 2 C 2 ... where I need it to ignore duplicates and report: A 2 B 2 C 2 ... Anyone have any suggestions on how to do this within the R paradigm? Walter Anderson

[R] Calculating area of polygons created from a spatial intersect

2015-03-27 Thread Walter Anderson
of each project/census block combination and only providing me a true/false indication. Is there any way to replicate the process from ArcInfo that I outlined above within R? Walter Anderson -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBAgAGBQJVFWYWAAoJEHfnxjvhypCiMc8P/2Dsja+h4RKuR7ygHx+oI

[R] Is this a bug or am I making a mistake?

2014-01-06 Thread Walter Anderson
I have a data frame that I am extracting some records from and noticed the following issue I originally used tmp - subset(dd, dd$EVYEAR==2012 dd$EVMONTH=='02') and noticed that I wasn't ending up with all of the records I should have; however, when I used tmp - dd[dd$EVYEAR==2012

Re: [R] Is this a bug or am I making a mistake?

2014-01-06 Thread Walter Anderson
don't need the dd$ in the arguments to subset(). But those don't explain your result given the information provided. Please provide more information. Sarah On Mon, Jan 6, 2014 at 12:06 PM, Walter Anderson wandrso...@gmail.com wrote: I have a data frame that I am extracting some records from

Re: [R] Need help figuring out sapply (and similar functions) with multiple parameter user defined function

2013-12-10 Thread Walter Anderson
Petr, Thank you for you assistance. Particularly this last bit. It really helped me understand exactly how your solution worked and why I was confused by rapply processing rows. It was apply that could process rows (and/or columns) of a matrix, Anyway for anyone who wants the version of

Re: [R] Need help figuring out sapply (and similar functions) with multiple parameter user defined function

2013-12-09 Thread Walter Anderson
) Bind result with original data survey.results - cbind(survey.results, result) And voila, you shall have reqiured values. Regards Petr *From:*Walter Anderson [mailto:wandrso...@gmail.com] *Sent:* Monday, December 09, 2013 4:37 PM *To:* PIKAL Petr *Subject:* Re: [R] Need help figuring

Re: [R] Need help figuring out sapply (and similar functions) with multiple parameter user defined function

2013-12-09 Thread Walter Anderson
Karen, Thank you for your reply. That approach makes the code for determining preference much clearer. Unfortunately, it appears I am still needing to use a for loop to process each row. For any who find these posts and may have similar questions, I am including my current code and sample

[R] Need help figuring out sapply (and similar functions) with multiple parameter user defined function

2013-12-06 Thread Walter Anderson
I am having trouble understanding how to use sapply (or similar functions) with a user defined function with multiple parameters. I have the following functions defined q1.ans - function(x) { retVal = 0 if (x == 1) { retVal = 1 } else if (x ==2) {

Re: [R] Need help figuring out sapply (and similar functions) with multiple parameter user defined function

2013-12-06 Thread Walter Anderson
- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Walter Anderson Sent: Friday, December 06, 2013 4:44 PM To: r-help@r-project.org Subject: [R] Need help figuring out sapply (and similar functions) with multiple parameter user defined function I am having

Re: [R] Need help figuring out sapply (and similar functions) with multiple parameter user defined function

2013-12-06 Thread Walter Anderson
On 12/06/2013 10:43 AM, William Dunlap wrote: I have been researching and it appears that I should be using the sapply function to apply the evaluate.question function above to each row in the data frame like this Read the documentation more closely: sapply(dataFrame, func) applies func() to

Re: [R] Need help figuring out sapply (and similar functions) with multiple parameter user defined function

2013-12-06 Thread Walter Anderson
Software wdunlap tibco.com -Original Message- From: Walter Anderson [mailto:wandrso...@gmail.com] Sent: Friday, December 06, 2013 9:58 AM To: William Dunlap; r-help@r-project.org Subject: Re: [R] Need help figuring out sapply (and similar functions) with multiple parameter user defined

[R] Close with a ggplot chart but need a little assistance

2013-08-22 Thread Walter Anderson
I have the following code and data data.csv ,Goal,Frequency,Weight,Group 1,Move,13,0.245283018867925,Public 2,Create,10,0.188679245283019,Public 3,Strengthen,30,0.566037735849057,Public 4,Move,6,0.6,Board 5,Create,0,0,Board 6,Strengthen,4,0.4,Board 7,Move,19,0.301587301587302,Total

[R] How to store and manipulate survey data like this?

2013-08-13 Thread Walter Anderson
I have to process a set of survey data with questions that are formatted like this; 1) Pick your top three breeds (pick 3) 1 Rottweiler 2 Pit Bull 3 German Shepard 4 Poodle 5 Border Collie 6 Dalmation 7 Mixed Breed and the answers are formatted like this: Respondent, Question1

[R] Regression of categorical data

2013-08-13 Thread Walter Anderson
I have a set of survey data where I have answers to identify preference of three categories using three questions 1) a or b? 2) b or c? 3) a or c? and want to obtain weights for each of the preferences something like X(a) + Y(b) + Z(c) = 100% I am at a loss how how to calculate this from

Re: [R] How to store and manipulate survey data like this?

2013-08-13 Thread Walter Anderson
On 08/13/2013 11:41 AM, Siraaj Khandkar wrote: On 08/13/2013 12:17 PM, Walter Anderson wrote: I have to process a set of survey data with questions that are formatted like this; 1) Pick your top three breeds (pick 3) 1 Rottweiler 2 Pit Bull 3 German Shepard 4 Poodle 5 Border

Re: [R] Faster way to implement this search?

2012-03-17 Thread Walter Anderson
On 03/17/2012 12:53 AM, Jeff Newmiller wrote: for(indx in 1:(length(bin.05)-3)) if ((bin.05[indx] == test.pattern[1]) (bin.05[indx+1] == test.pattern[2]) (bin.05[indx+2] == test.pattern[3])) return.values$count.match.pattern[1] =

[R] Faster way to implement this search?

2012-03-16 Thread Walter Anderson
of achieving the same answer? Walter Anderson __ R-help@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

[R] How to eliminate for next loops in this script

2012-03-06 Thread Walter Anderson
I needed to compute a complicated cross tabulation to show weighted means and standard deviations and the only method I could get that worked uses a series of nested for next loops. I know that there must be a better way to do so, but could use some assistance pointing the way. Here is my

[R] Need help using Melt and cast to compute correlation for a cross tabulation

2012-03-01 Thread Walter Anderson
? Walter Anderson __ R-help@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.

[R] How to process raw trip records to get number of persons per trip by vehicle

2011-05-27 Thread Walter Anderson
use of any of the R features. Does anyone have any suggestions for how they would implement this analysis in R? Walter Anderson __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

[R] Need a more efficient way to implement this type of logic in R

2011-04-06 Thread Walter Anderson
I have cobbled together the following logic. It works but is very slow. I'm sure that there must be a better r-specific way to implement this kind of thing, but have been unable to find/understand one. Any help would be appreciated. hh.sub - households[c(HOUSEID,HHFAMINC)] for (indx in

[R] How to regress data into coefficients for a gamma function

2011-03-29 Thread Walter Anderson
Hello, I need to regress data like the example below. The data points represent friction factors derived from observed trip length data. The function used to describe this data is a gamma function of the form, f(t) = a * t^b * e^(c*t) and I need to regress the data to obtain the a,b, and