Re: [R] sampling dataframe based upon number of record occurrences

2015-03-04 Thread Curtis Burkhalter
d))),] > } > > Now take the samples and combine them into a single data frame: > > sample <- do.call(rbind, lapply(dta.list, smp)) > sample > > - > David L Carlson > Department of Anthropology > Texas A&M University > Colle

Re: [R] sampling dataframe based upon number of record occurrences

2015-03-04 Thread JS Huang
Since you indicated there are six more columns in the data.frame, getSample modified below to take care of it. > getSample function(x) { sites <- unique(x$SiteID) years <- unique(x$Year) result <- data.frame() x$ID <- seq(1,nrow(x)) for (i in 1:length(sites)) { for (j in 1:length(y

Re: [R] sampling dataframe based upon number of record occurrences

2015-03-04 Thread JS Huang
Here is an implementation with function named getSample. Some modification to the data was made so that it can be read as a table. > fitting.set IDbyYear SiteID Year 1 42.24 A-Airport 2006 2 42.24 A-Airport 2006 3 42.24 A-Airport 2006 4 42.

Re: [R] sampling dataframe based upon number of record occurrences

2015-03-04 Thread David L Carlson
versity College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Curtis Burkhalter Sent: Tuesday, March 3, 2015 3:23 PM To: r-help@r-project.org Subject: [R] sampling dataframe based upon number of record occurrences Hello everyone, I&#x

[R] sampling dataframe based upon number of record occurrences

2015-03-03 Thread Curtis Burkhalter
Hello everyone, I'm having trouble performing a task that is probably very simple, but can't seem to figure out how to get my code to work. What I want to do is use the sample function to pick records within in a dataframe, but only if a column attribute value is repeated more than 3 times. So if

Re: [R] Sampling dataframe

2009-11-28 Thread Juliet Hannah
Here are some options that may help you out. First, let's put the data in a format that can be cut-and-pasted into R. myData <- read.table(textConnection("var1 var2 var3 1 111 2 312 3 813 4 614 51015 6 221 7 422 8

[R] Sampling dataframe

2009-11-25 Thread Ronaldo Reis JĂșnior
Hi, I have a table like that: > datatest var1 var2 var3 1 111 2 312 3 813 4 614 51015 6 221 7 422 8 623 9 824 10 1025 I need to create another table based on that with th