Questions tagged [find-occurrences]
435 questions
2
votes
2 answers
Ansible: How to find word occurrence in a variable?
I have searched everywhere on how to find the word occurrence in variable for Ansible but not found. The closest way I found is by searching any 'word' in a variable but it does not count how many words are there and only returning boolean value.…

Fitri Izuan
- 350
- 1
- 6
- 18
2
votes
2 answers
DAX Power BI occurrences of character in string
-- my DAX formula is unable to count the occurrences of a "," (comma) in a string from Column2, in a specific "Category" row. --
Formula = CALCULATE(
COUNTAX( FILTER ('Query1', 'Query1'[Col1] = "Category", 'Query1'[Col2] = ",") )
)
-- Any…

חִידָה
- 259
- 1
- 2
- 14
2
votes
2 answers
How to create a co-occurrence matrix calculated from combinations by ID/row in R?
Update
Thanks to @jazzurro for his anwer. It made me realize that the duplicates may just complicate things. I hope by keeping only unique values/row simplifies the task.*
df <- data.frame(ID = c(1,2,3,4,5),
CTR1 = c("England",…

Seb
- 179
- 1
- 8
2
votes
1 answer
Is there a way to find a single occurence of a digit in a vector and ignore duplicates in R?
I have an array of numbers and I'd like to find the index of a specific digit ONLY when it's occuring alone, NOT when it's occuring in a sequence of the same digit.
For example:
a <- c(1,2,4,5,5,8,1,2,8,8,8,4,3)
I would like to find the index of…

Inkling
- 469
- 1
- 4
- 19
2
votes
2 answers
how do i find the occurrence and percentage of occurance of a word in a string ; how to fix error
basically i have this excel file that i uploaded to python, i made a new column which identified if a word was in each row and if it was in a row then it would come out as true, if not false. So i have this new column and im trying to find the…

mixjr365 cool
- 31
- 2
2
votes
4 answers
SED replace few first occurences ( and ranges ) of pattern
is this possible to change first 4 ( or more ) occurences of string in this scenario using SED (opposite of sed -r 's/[^[:space:]]*/TEST/4g'):
TEST TEST TEST TEST five six seven
I get it working with reversing words order in line using AWK twice,…

mike
- 275
- 1
- 12
2
votes
3 answers
Count total occurences of elements from string array in a text
I have a
public static string[] words = {"word1","word2","word3"};
I want to count occurences of word1 + occurences of word2+ occurences of word3 in a string.
I tried
Regex.Matches(string, "word1").Count
which works fine for a single word but…

Claudinho18
- 79
- 8
2
votes
1 answer
Linux: Recursively find all .txt files that don't have a matching .tif
I am using Debian Linux. I'm a newbie. I'll do my best to ask in the simplest way I know.
I have a pretty deep tree of directories on a drive that contain thousands of .tif files and .txt files. I'd like to recursively find (list) all .txt files…

allenjm
- 23
- 2
2
votes
5 answers
Finding Occurance of Max Value in Array
I am trying to find the Occurrences of a Maximum value in Integer Array.
e.g.
int[] ar = [3, 1, 2, 3];
Here, the Max 3 is repeated twice and so the expected output is 2.
This works, I am getting count as 2 as the max value 3 occurred twice in the…

Hary
- 5,690
- 7
- 42
- 79
2
votes
3 answers
R: Frequency of all column combinations
Problem description
I have a list of strings of equal size like this:
example.list <- c('BBCD','ABBC','ADDB','ACBB')
Then I want to obtain the frequency of occurence of specific letters at specific positions.
First I convert this to a matrix:
…

CodeNoob
- 1,988
- 1
- 11
- 33
2
votes
8 answers
I want to display the occurrence of a character in string. How can I improve my code?
I want to create a program that will display the number of occurrences of a character in a string and also count them. Right now the code just counts the characters.
I want to make the following changes:
1) How do I make this program only count one…

user10369729
- 67
- 2
- 3
- 9
2
votes
3 answers
Best Way / data structure to count occurrences of strings
Lets assume I have a very long list of strings. I want to count the number of occurrences of each string. I don't know how many and of what kind the strings are (means: I have no dictionary of all possible strings)
My first idea was to create a Map…

KFleischer
- 942
- 2
- 11
- 33
2
votes
2 answers
How to add a unique value to differentiate between duplicate data in a Swift array?
Could someone point me in the right direction on how to solve this issue, please?
I am creating table cells with the values from the structure below. The cells are created and the data is displayed in the cells by the time they were created which…

STerrier
- 3,755
- 1
- 16
- 41
2
votes
1 answer
How to convert two associated arrays so that elements are evenly distributed?
There are two arrays, an array of images and an array of the corresponding labels. (e.g pictures of figures and it's values)
The occurrences in the labels are unevenly distributed.
What I want is to cut both arrays in such a way, that the labels…

Rombrand
- 21
- 4
2
votes
4 answers
count the occurrence of categorical variables in R
I have a data frame which consists of three categorical variables, and I want to find the frequency of each combination and sort the result by the frequency in descending order as follow:
my data:
A LEVEL1 PASS
A LEVEL1 FAIL
B LEVEL2 PASS
…

Manal
- 75
- 3
- 12