similar to: Counting Elements Conditionally

Displaying 20 results from an estimated 3000 matches similar to: "Counting Elements Conditionally"

2012 Mar 05
2
Running Total
I'm am trying to create a vector that has a running total that adds each time a 1 occurs. here's the code and data c(1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L,
2011 Aug 05
1
If find x, then y, else do nothing
I want to write code that says "If you find an element equal to 4 in this vector for each person in the data set tested separately, then put in 1 for 2 and 2 for 4, else leave the variable as is" u.ppl <- (unique(init.dat1$grid)) l.ppl <- length(u.ppl) for (i in 1:l.ppl) { if (grep("4",init.dat1$Slide1_RESP)) {2 == 1, 4 == 2}; else
2011 Jul 27
1
Hidden Markov Models in R
R Community - I am attempting to fit a model as described in Hampton, Bossaerts, and O'doherty (J. Neuroscience) 2006. They use a bayesian hidden markov model to model the Reversal Learning data. I have tried using HMM and depmixS4 with no success. My data is a Reversal Learning Task in which there are 3 sets of patterns over 3 blocks. The participant receives incorrect or correct
2011 Jun 28
2
Loop through each subject
R help - I am attempting to write a script that has multiple subjects in 1 data file. Each subject has multiple rows with columns as variables. Here is my code, I am having problem executing it on each unique subject id (dat$Subject). getwd() setwd("/Users/edwardpatzelt/Desktop/Neuroimaging/MERIT/SRRT/merge") dat <- read.table("test2.txt", header = TRUE, na.strings
2011 Nov 16
1
Cubic Gradient Descent Package
R - Does anyone know of a cubic gradient descent package? I found grad.desc() but that only allows for a 2d function. I have 3 free parameters and thus am looking for a 3d function. Thank you, -- Edward H. Patzelt Research Assistant – TRiCAM Lab University of Minnesota – Psychology/Psychiatry VA Medical Center S355 Elliot Hall: 612-626-0072 www.psych.umn.edu/research/tricam [[alternative
2012 Oct 19
2
Axis Breaks with ggplot2
R-help - I'm trying to create axis breaks similar to this : http://www.r-bloggers.com/wp-content/uploads/2010/08/bar-chart-natural-axis-split1.png . Is there a way to do this in R? Here's my code thus far: structure(list(condition = structure(c(2L, 1L, 3L), .Label = c("con", "exp", "unedit"), class = "factor"), trial.avg = c(4.04583333333333,
2011 Aug 15
0
Indexing Permutation Values
R-help - This code iterates over a function with 2 free parameters to find a list of values (which are the number of incorrect predictions for a computational model). I want to find the values of i,e when there is the minimum number of incorrect predictions. In other words, the value of "i" and "e" when variable "thesum" is at the lowest possible number. The
2016 Apr 22
1
Unique Ordering
Hi R-Help, data at bottom I've been struggling with a problem where I need to order based on 1) the Frequency "Freq" and 2) keeping each group of 3 of the same type together "Var2" but I want across all groups it to go "high to low" based on the earn factor. Thank you! structure(list(Var1 = structure(c(1L, 3L, 2L, 1L, 2L, 3L, 1L, 3L, 2L, 3L, 1L, 2L, 3L, 1L,
2012 Oct 31
2
Aggregate Table Data into Cell Frequencies
R-help - I have this set of aggregated tables (sample data below via dput()). And I would like to have delayValue as the column variables with the "temp" (temp1, temp2, temp3) values as the row variables. However I would like to have the temp variables *aggregated into single rows* so that I have the frequency ("Freq" | counts) of each time each "delayValue" occurs
2018 Jul 12
2
[Announce] Samba 4.9.0rc1 Available for Download
Great news!!! I just didn't see anything in the changelog referring to "trust relationship," based on what the papper below show. https://sambaxp.org/fileadmin/user_upload/sambaXP2018-Slides/StefanMetzmacher_sambaxp2018_trusted_domain_support-rev0-compact.pdf Any news about trusts? On Thu, Jul 12, 2018 at 6:41 PM Johannes Engel via samba < samba at lists.samba.org> wrote:
2011 Sep 27
1
Counting similar rows
Startsituation: structure(c(1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1), .Dim = 4:5, .Dimnames = structure(list(subject = c("s1", "s2", "s3", "s4"), class = c("c1", "c2", "c3", "c4", "c5")), .Names = c("subject", "class")), class = c("xtabs",
2015 Jan 27
2
[LLVMdev] build failure on mingw gcc 4.9.1
I encountered a new build failure (r227128) on my nightly build of LLVM for MinGW: FAILED: cmd.exe /c cd . && D:\MinGW\x86_64-4.9.1-release-posix-seh-rt_v3-rev0\mingw64\bin\c++.exe -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=gnu++11 -g
2018 Sep 18
2
design question for small environment
Ah, ok. Maybe you can do something with the static id mappings on the server. Map a computer to user But besides that, uhm, good luck... Stick with the login popup, and save yourself a lot of troubles. Maybe this wil give you a good hint, https://sambaxp.org/fileadmin/user_upload/sambaXP2018-Slides/StefanMetzmacher_sambaxp2018_trusted_domain_support-rev0-compact.pdf Imo, a hard one to
2009 May 15
1
data summary and some automated t.tests.
I would like to preform a t.test to each of the measured variables (sand.silt etc.) with a mean and sd for each of the treatments (up or down), and out put this as a table.... I am having a hard time starting- maybe it is to close to lunch. Any suggestions would be greatly appreciated. Stephen Sefick x <- (structure(list(sample. = structure(c(1L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 2L, 3L,
2010 Jul 02
2
Problem with aggregating data across time points
Hello- I have a dataset which basically looks like this: Location Sex Date Time Verbal Self harm Violence_objects Violence A 1 1-4-2007 1800 3 0 1 3 A 1 1-4-2007 1230 2 1 2 4 D 2 2-4-2007 1100 0
2011 Feb 19
1
problem in plotting numeric x by POSIXt class with lattice
# hi all, # I'm trying to plot temperatures by date in a trellis plot by their stations # I'm plotting the following data.frame library(lattice) h <- structure(list(station_name = structure(c(3L, 4L, 2L, 10L, 11L, 12L, 6L, 7L, 5L, 8L, 9L, 3L, 4L, 2L, 10L, 11L, 12L, 6L, 7L, 5L, 8L, 9L, 3L, 4L, 2L, 10L, 11L, 12L, 6L, 7L), .Label = c("Ashqelon", "Beer Sheva",
2018 Jan 30
1
Could the Odds represent weight in Generalized Linear Model?
Dear Lenny, You can do this by using Age as an offset factor. dataset$wAge <- dataset$Age * 1.02 glm(cbind(Yes,No) ~ offset(wAge) + Times + Type, family=binomial, data = dataset) Best regards, ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie &
2018 Jan 30
0
Could the Odds represent weight in Generalized Linear Model?
Dear Thierry, Thanks a lot for this answer, I mean i want to obtain such model *Behavior1 = ?0+?1*Age* , the purpose is to obtain *?1*. I want to be sure that the odds value could be the ?1. Or how to calculate it ? Thanks again for your precious help. Lenny <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
2011 Feb 04
1
read.table error
R experts, I am working with a fairly large data set comprised of 563 rows by 116 columns including several different modes. I have been unable to read in the data set completely using the read.table function and the RGui (i.e. nearly half the total number of rows are missing from the data set along with the column names). The data does read in fully using Tinn-R's Rterm; however, at several
2018 Jan 30
2
Could the Odds represent weight in Generalized Linear Model?
Hello all, I'm sorry if my question seems basic. Im studying a responses (Yes,No) in a survey and, thanks to GLM I obtain the following relation with my variables : (Yes,No)~ ?0 + Age We note this this certain type of (Yes,No) response is linked to age (p<0.05 in glm) . After that we calculated : model1=glm(cbind(Yes,No) ~ Age + Times + Type, family=binomial) summary(model1)