Question: X _ 6 0 : 1 1 0 1 1 1 1 0 0 1 0 1 1 1 1 1 1 0 0 1

X_60 : 11011110010111111001110111101110111101010101
1. Write a for loop that counts the number of instances of the strings 11 and 00 in a string such as the one given above. Although it does not occur in the string above, be sure that your loop would not count strings of 11s or 00s that occur in the last two positions of the string. Verify that there are 19 instances of the string 11 and two instances of the string 00.
2. Modify your loop to include code that counts how many of the hit streaks were followed by a hit and how many of the miss streaks were followed by a hit. Verify that for the string given above, 12 of the 19 instances of the string 11 were followed by a hit and both of the instances of the string 00 were followed by a hit.
Written in R Code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!