similar to: Counting by rows based on multiple criteria

Displaying 20 results from an estimated 7000 matches similar to: "Counting by rows based on multiple criteria"

2008 Oct 06
3
[LLVMdev] sext..to instruction
Hi, I have a question about the "sext..to" instruction. In the document, I found two examples: %x = sext i8 -1 to i16 It means: i8 -1 = 1111 1111 --> 1111 1111 1111 1111 = i16 how can it determinate, that the i16 value %x positive is (65535)? And the second example: %y = sext i1 true to i32 1 --> 1111 1111 1111 1111 1111 1111 1111 1111 In this example, %y is -1 I'm not sure
2010 Feb 05
2
ifelse on a series of rows for multiple criteria
Dear all, I am attempting to perform a calculation which counts the number of positive (or negative) values based on the sample mean (on a per-row basis). If the mean is>0 then only positive values should be counted, and if the mean is <0 then only negative values should be counted. In cases where the mean is equal to zero, the value -99999 should be returned. The following is an example
2011 Jun 24
2
counting columns that fulfill specific criteria
Hi, I have a matrix (pwdiff in the example below) with ~480000 rows and 780 columns. For each row, I want to get the percentage of columns that have an absolute value above a certain threshold "t". I then want to allocate that percentage to matrix 'perc' in the corresponding row. Below is my attempt at doing this, but it does not work: I get 'replacement has length
2002 Aug 31
2
Counting elements in 2 rows of a matrix
Dear R-users: Sorry to bother so late with this question, which surely has simple answer. I'm working with matrices that contain either "1" or "0", for example: [,1] [,2] [,3] [,4] [,5] A 1 0 1 0 0 B 0 1 0 1 0 C 1 0 1 0 0 D 1 1 1 0 1 I want to count the number of "1" common to, say, A and B, the
2011 Nov 10
3
counting columns that match criteria
Hi, I am a little new in R but I'm finding it extremely useful :) Here's my tiny question: I've got a table with a lot of columns. What I am interested now is to evaluate how many of 4 columns have a value greater than 1. I think it can be done with subset() but it will take a very long condition and become unfeasible if I want to compare more than 4 columns. I put here a small
2008 Oct 06
0
[LLVMdev] sext..to instruction
> I'm not sure about it, when sext to results a positve/negative value? sext does signed-extension, zext does unsigned-extension. This means that zext always extends by zero bits, while with sext the additional bits are all copies of the top bit of the original value. So with sext, if it was negative in the original type when considered as a signed value, then it will be negative in the
2012 May 21
1
Complex text parsing task
Hello Everyone, I have what I think is a complex text parsing task. I've provided some sample data below. There's a relatively simple version of the coding that needs to be done and a more complex version. If someone could help me out with either version, I'd greatly appreciate it. Here are my sample data. haveData <- structure(list(profile_key = structure(c(1L, 1L, 2L, 2L, 2L,
2012 May 31
3
How can I get this function to work?
Hello All, Can anyone tell help me understand why the function below doesn't work and how I can fix it? Below are some sample data, some code that works on individual rows of the data, and my attempt to translate that code into a function. My hope is to get the function working and then to apply it to the larger data frame using ddply() from the plyr package or possibly some other approach.
2003 Jan 16
1
bootstraping lm
Hi I'm doing a bootstrap of a linear model using: boot.fishpower <- function(data, i){ data <- data[i,] fplm <- lm(log(U)~Q+S+P+B+D, data=data) fp <- coef(fplm) exp(fp) } > boot(logglm.data,boot.fishpower,100) Error in "[<-"(*tmp*, r, , value = statistic(data, i[r, ], ...)) : number of items to replace is not a multiple of replacement length
2005 Dec 08
1
logistic regression with constrained coefficients?
I am trying to automatically construct a distance function from a training set in order to use it to cluster another data set. The variables are nominal. One variable is a "class" variable having two values; it is kept separate from the others. I have a method which constructs a distance matrix for the levels of a nominal variable in the context of the other variables. I want to
2011 Jan 25
5
Counting number of rows with two criteria in dataframe
Hi R-users, I'm trying to find an elegant way to count the number of rows in a dataframe with a unique combination of 2 values in the dataframe. My data is specifically one column with a year, one with a month, and one with a day. I'm trying to count the number of days in each year/month combination. But for simplicity's sake, the following dataset will do:
2008 Nov 10
1
comparing rows - a possible solution
Hello, sorry for posting this independently of the original thread, but it is not that easy to answer to mails, when receiving the r-help as digest... ... The question was: > I compare each row of a matrix with each row of another matrix. > > testmat1 <- matrix(c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16), nrow=4) > testmat2 <- matrix(c(1,2,3,5,5,6,7,8,9,10,11,12,13,14,15,16),
2005 Nov 10
2
ltext - adding text to each panel from a matrix
Hi all (really probably just Deepayan): In the plot below I want to add text on either side of each violin plot that indicates the number of observations that are either positive or negative. I'm trying to do this with ltext() and I've also monkeyed about with panel.text(). The code below is generally what I want but my calls to ltext() are wrong and I'm not sure how to fix them.
2007 Sep 15
3
applying math/stat functions to rows in data frame
Hi All, There are a variety of functions that can be applied to a variable (column) in a data frame: mean, min, max, sd, range, IQR, etc. I am aware of only two that work on the rows, using q1-q3 as example variables: rowMeans(cbind(q1,q2,q3),na.rm=T) #mean of multiple variables rowSums (cbind(q1,q2,q3),na.rm=T) #sum of multiple variables Can the standard column functions (listed in the
2011 Jun 02
3
Removing rows of zeros from a matrix
Hi, Can someone tell me how to remove rows of zeros from a matrix? For example if I have the following matrix, 0 0 0 1 2 8 0 0 4 56 I should end up with 0 1 2 8 4 56 -- Thanks, Jim. [[alternative HTML version deleted]]
2008 Feb 15
2
Remove rows with NA across all columns
Hi I have a data frame df with 3 columns. Some rows are NA across all 3 columns. How can I remove rows with NA across all columns? df=data.frame(col1=c(1:3,NA,NA,4),col2=c(7:9,NA,NA,NA),col3=c(2:4,NA,NA,4)) Thanks Joseph ____________________________________________________________________________________ Be a better friend, newshound, and [[alternative HTML version deleted]]
2004 Mar 11
3
making operators act on rows of a data frame
Dear R helpers, I wish to use the "sum" operator for each row of a data frame. However, it appears that the operator acts on the entire data frame, over all columns. What is the best way to obtain row- wise operation? The following code shows my attempts so far, and their problems:- test1=array(rbinom(120,1,0.5),c(20,3)) test1[,3]=NA sum(test1[,1:2]) test1[,3][sum(test1[,1:2])>=2]=1
2011 Apr 04
1
Support Counting
Hi, I'm new to R and trying to some simple analysis. I have a data set with about 88000 transactions and i want to perform a simple support count analysis of an itemset which is say not a complete transaction but a subset of a transaction. say {A,B,D} is a transaction and i want to find support of {A,B} even though it never occurs as only A,B in the entire set To this i needed to create
2005 Feb 07
4
proportional matrix rows
Hi I have a two-column integer matrix like this: R> jj [,1] [,2] [1,] -1 1 [2,] -2 2 [3,] -7 6 [4,] -8 7 [5,] -6 5 [6,] -9 8 [7,] -5 4 [8,] 3 -3 [9,] -10 9 [10,] -4 3 I want a diagnostic that detects whether a row is a multiple of the first row or not. In this case, this would be rows 1,2, and 8. How to do this
2009 Apr 28
1
Finding rows common to two datasets
Dear all, I have 2 data frames, both with 14 columns of data and differing numbers of rows. The first two columns are 'Latitude' and 'Longitude'. I want to find the pairs of Latitude and Longitude coordinates which are common to both datasets, and output a new data frame which is composed of these coincident rows. I tried using the 'unique' command, but had difficulties