Questions tagged [find-occurrences]
435 questions
2
votes
3 answers
Perl: Can not print occurence of string "." from an array
i have an array which contain (head , b , v , . , b, v, end).
i try to find and get the ".", and do sth after that (example: print out ).
for unknown reason i can't get the "."
so i did a simple code to count occurence of char inside the…

ask91
- 45
- 1
- 11
2
votes
2 answers
SQL Query to find the value which has max number of occurrences in a table without nesting
I'm working on the following schema (bold text stands for pk, and ":" stand for referenced tables) :
USERS(username, name, surname);
PRODUCTS(id, name, quantity);
PURCHASES(user:USERS, product:PRODUCTS, dateAndTime, quantityPurchased);
I want to…

zarathustra51
- 25
- 1
- 3
2
votes
7 answers
Count occurrences of elements inside array? (Java)
I have been working on trying to figure out this algorithm for about 6 hours now and can't seem to come up with a solution. I am trying to count the occurrences of elements inside an array and may two more separate arrays. One for the unique…

helloMundo
- 87
- 1
- 4
- 11
2
votes
2 answers
R How to count occurrences of values across multiple columns of a data frame and save the columnwise counts from a particular value as a new row?
I have a large data-frame (approx 1,000 rows and 30,000 columns) that looks like this:
chr pos sample1 sample2 sample3 sample 4
1 5050 1 NA 0 0.5
1 6300 1 0 0.5 1
1 7825 1 0 0.5 …

user2903950
- 65
- 1
- 2
- 7
2
votes
1 answer
How to find the occurrence of k-mers in a list of DNA sequences
I want to scan a list of DNA sequences against a list of given k-mers; each element on the k-mer list is a set of similar k-mers of equal length, they look like
myKmer1=c("TATGGGTTT", "TAAGGGTTT", ...,"CAAGGGTTT")
...…

Paul.j
- 794
- 2
- 8
- 17
2
votes
3 answers
How to count conditional occurence in R?
I have a set of data :
Color Type axe
Green 1 2
Green 1 3
Green 0 1
Black 1 1
Black 0 2
Black 0 3
I want to return a table that tells me how many time a 'Type' is green or black and a 'axe' is green or black.
Type
1 …

LouInNY
- 111
- 1
- 2
- 9
2
votes
2 answers
Maximum occurrences
I want to find the element in array which has maximum occurrences and know the number of occurrences. Please suggest me fastest C++ code to do so.(You are free to use STL if that can be of any help.)

Kartik Khare
- 71
- 1
- 9
2
votes
1 answer
Counting number of occurances in an Array
I want to count number of occurances in an array in ActionScript 3.0. Say I have
var item:Array = ["apples", "oranges", "grapes", "oranges", "apples", "grapes"];
How can I make it show the number of matching strings? For instance, result: apples =…

rohan
- 107
- 3
- 10
2
votes
1 answer
How to find occurrence of a format in NSString
I am reading a feed, and need to find the occurrence of a string format, for example, in "Feed for 03/02/2012". Now this date will always be of the format: %@/%@/%@. I need to find is this format occurs, and thus extract the date. The date and month…

Bani Uppal
- 866
- 9
- 17
1
vote
1 answer
Looking for a better way to find the most occurring letter in every position in a list of strings
I have a list like
words = ["test", "secondTest", "thirdTest"]
and I have a function to find for every position, the most occurring element through the list, e.g. the most occurring element in first position is 't', in second is 'e' and so on.
The…

MattMlgn
- 33
- 7
1
vote
2 answers
Maximum occurrences in a list
I have a data frame like the one below.
import pandas as pd
data = {'Date': ['2022/09/01', '2022/09/02', '2022/09/03', '2022/09/04', '2022/09/05','2022/09/01', '2022/09/02', '2022/09/03', '2022/09/04', '2022/09/05','2022/09/01', '2022/09/02',…

PJL
- 21
- 3
1
vote
4 answers
How to store only the first occurrence in a for loop?
I tried to code k as a cumulatively increasing variable until it reaches 15. j is supposed to store the point when k exceeds 10 for the first time. However, obviously, j is going to store all the occurrences instead which is not desirable for my…

Rel_Ai
- 581
- 2
- 11
1
vote
1 answer
Google Sheets Conditional Formatting multiple criteria excluding first date occurrence
I have a bunch of assessment data for pre and post testing and am trying to highlight the rows in which a post-test(s) had 0 or negative gains. There is scaled gains data for the first test that I cannot remove (based on prior SY tests) and I would…

Bri
- 31
- 5
1
vote
1 answer
Generate Label by First occurrence
Below is a snapshot of my data frame, and I have a list of ID from 1 to N, with outcomes 1 or 0. What I am trying to do is to generate the Label and csum columns basic on the occurrence of the outcome in Python, how do I achieve this and loop…

kata1000
- 60
- 4
1
vote
2 answers
SQL Server - find horizontal occurrences
I am using SQL Server 2008R2 and have tableA that has four columns res_id,res_id2,res_id3,res_id4 numeric.
I want to find away to find the occurrences of the same IDs on each row (the met column) excluding 0 or null
Example:
golf_id res_id res_id2…

PanosPlat
- 940
- 1
- 11
- 29