subset

Reactive subset in ddply for rmarkdown shiny

旧城冷巷雨未停 提交于 2020-01-25 00:34:27
问题 I am trying to calculate and plot % yield of some data based on user definable inputs. I am using rmarkdown and shiny to do this. I keep getting stuck when passing a reactive subset through ddply to count the number of rows in the subset.."invalid (null) left side of assignment". Here is an example data set: --- title: "Yield3" author: "P Downs" date: "Tuesday, May 26, 2015" output: html_document runtime: shiny --- # Create user input for reactive subsetting ```{r echo=FALSE} sliderInput(

Finding number of subsets of an array that add up to a multiple of a specific number

那年仲夏 提交于 2020-01-24 13:59:05
问题 I have an array A of length N of negative as well as positive integers. I need to count the number of subsets in this array which add up to a multiple of a number M (or 0 (mod M)) For example: Let A = {1,2,8,4,5}, M = 9, Then, there are 4 such subsets: {}: Empty set, corresponding to the multiple 0, {1,8}: corresponding to the multiple 9, {4,5}: corresponding to the multiple 9 {1,8,4,5}: corresponding to the multiple 18. I thought of generating all possible multiples and then applying dynamic

Getting 1D Subsets of Multi dimensional arrays in julia

走远了吗. 提交于 2020-01-23 11:54:32
问题 I have a multi dimensional array in julia: julia> ac.value 3x100x3 Array{Float64,3}: [:, :, 1] = 0.29238 0.0751815 0.00843636 … -0.0143826 0.0403283 0.0225896 0.263146 0.080687 0.000462262 -0.00635778 0.0307563 0.0379104 0.992458 0.986423 0.980587 0.561173 0.55516 0.549105 [:, :, 2] = 0.362155 0.13406 0.0741124 … 0.0231614 0.0156455 0.0121797 0.325581 0.11181 0.0447847 0.0098042 0.0193873 0.0146943 0.914888 0.852297 0.796608 -0.0500265 -0.0551787 -0.0520171 [:, :, 3] = 0.269976 0.108082 0

What's the higher-performance alternative to for-loops for subsetting data by group-id?

╄→尐↘猪︶ㄣ 提交于 2020-01-22 14:38:12
问题 A recurring analysis paradigm I encounter in my research is the need to subset based on all different group id values, performing statistical analysis on each group in turn, and putting the results in an output matrix for further processing/summarizing. How I typically do this in R is something like the following: data.mat <- read.csv("...") groupids <- unique(data.mat$ID) #Assume there are then 100 unique groups results <- matrix(rep("NA",300),ncol=3,nrow=100) for(i in 1:100) { tempmat <-

What's the higher-performance alternative to for-loops for subsetting data by group-id?

我的未来我决定 提交于 2020-01-22 14:38:07
问题 A recurring analysis paradigm I encounter in my research is the need to subset based on all different group id values, performing statistical analysis on each group in turn, and putting the results in an output matrix for further processing/summarizing. How I typically do this in R is something like the following: data.mat <- read.csv("...") groupids <- unique(data.mat$ID) #Assume there are then 100 unique groups results <- matrix(rep("NA",300),ncol=3,nrow=100) for(i in 1:100) { tempmat <-

Subset with unique cases, based on multiple columns

六眼飞鱼酱① 提交于 2020-01-19 04:32:26
问题 I'd like to subset a dataframe to include only rows that have unique combinations of three columns. My situation is similar to the one presented in this question, but I'd like to preserve the other columns in my data as well. Here's my example: > df v1 v2 v3 v4 v5 1 7 1 A 100 98 2 7 2 A 98 97 3 8 1 C NA 80 4 8 1 C 78 75 5 8 1 C 50 62 6 9 3 C 75 75 The requested output would be something like this, where I'm looking for unique cases based on v1, v2, and v3 only: > df.new v1 v2 v3 v4 v5 1 7 1 A

identify time sequence in data and subset by that sequence r

喜你入骨 提交于 2020-01-17 04:30:10
问题 I am trying to write a code that identifies the length of a repeating time sequence (in seconds) in R and subsets each sequence into its own data frame for curve fitting and analysis. Each sequence is a time series of sensor voltage output and has to be analyzed separately. My code seems clunky, but it works as it is written here. I am trying to figure out if there was a package or easy step that I was missing for doing this more elegantly. The seconds are decimal seconds and the data could

Calculating Minimal Subset With Given Sum

醉酒当歌 提交于 2020-01-17 01:12:45
问题 I was doing a problem in Scala and this is the summary of the task statement: There is a list of integers (of length N, 0 < N < 10^5) and another integer S (0 < S < 10^15). You are required to find the minimal size of the minimal subset of the given list of which the sum of elements (in the subset) is greater than or equal to S. Input is given as below: 4 4 12 8 10 4 4 13 30 100 Output for above example: 1 2 3 -1 First line is length of array, the second is the array of integers (0 < A[i] <

How to filter a dataset by the time stamp

蓝咒 提交于 2020-01-16 05:30:16
问题 I'm working with some bird GPS tracking data, and I would like to exclude points based on the time stamp. Some background information- the GPS loggers track each bird for just over 24 hours, starting in the evening, and continuing through the night and the following day. What I would like to do is exclude points taken after 9:30pm on the day AFTER deployment (so removing points from the very end of the track). As an R novice, I'm struggling because the deployment dates differ for each bird,

How to subset or aggregate large amounts of data so I can make separate pie charts

非 Y 不嫁゛ 提交于 2020-01-15 12:18:05
问题 My data looks like this: Trip_Set sex 119_4 hembra 119_4 hembra 119_7 hembra 161_7 macho 193_8 hembra 255_7 macho 271_6 hembra 271_6 macho 271_6 hembra 328_7 hembra 403_3 hembra 428_2 hembra 655_4 hembra As you can see, each Trip_Set has a number of males or females (some just have one). I wish to make a separate pie chart for each trip set to show the ratio of males to females for each. This is just a snippet of my dataset (the real one is much larger with hundreds of Trip_Sets). My code for