I have a dataset stored as a list DataList
[[1]]
[1] a
[2] f
[3] e
[4] a
[[2]]
[1] f
[2] f
[3] e
I am trying to create a function Getfrequence which return the frequence of a given pattern in the list DataList
GetFrequence<- function(pattern, DataList)
{
freq= 0
i = 1
while (i<= List.length())
{
if (.....)
freq= freq + 1
}
return freq
}
My question is how can I search if the given pattern exists in the list?