21 Matching Annotations
1. Feb 2019
2. crumplab.github.io crumplab.github.io

### using replicate

``````sl_board <- c(1,2,11,4,5,17,7,8,18,12,11,12,13,4,15,16,17,18,
8,20,21,20,23,16,25,26,27,28,29,30,31,32)

run_game <- function(a_board){
count <- 0
position <- 1
while(position < 25){
count <- count+1
position <- a_board[position+sample(seq(1,6),1)]
}
return(count)
}

mean(replicate(10000,run_game(sl_board)))
``````

#### URL

3. Oct 2017
4. crumplab.github.io crumplab.github.io
1. people to vie

this is confusing.

#### URL

5. Sep 2017
6. crumplab.github.io crumplab.github.io
1. intentions to have unprotected sex—but only for students who were low in self-esteem. Although there are many challenges involved in conducting a study like this, one of the primary ones is the measurement of the relevant variables. In this study, the researchers needed to know whether each of their participants had high or low self-esteem,

say whqtever you wnat

#### URL

7. crumplab.github.io crumplab.github.io
1. Students already familiar with one programming language should find R fairly easy to pick up. Students not familiar any programming language may find learning R more challenging. Learning your first programming language is always challenging, and takes time, effort, pract

say something

#### URL

8. crumplab.github.io crumplab.github.io
1. Research Methods for Psychology

Use hypothesis to annotate this textbook

#### URL

9. crumplab.github.io crumplab.github.io
1. 100 doors problem.
``````doors<-rep(0,100)

for(i in 1:100) {
for(j in seq(i,100,by=i)){
if(doors[j]==0){
doors[j]<-1
} else {
doors[j]<-0
}
}
}
doors
``````
2. Monte Hall problem.
``````#no switch
StayWin<-c()
for(i in 1:1000){
Doors<-c(1,0,0)
ChoiceOne<-sample(Doors,1)
StayWin<-c(StayWin,ChoiceOne)
}
sum(StayWin)/length(StayWin)

#switch
SwitchWin<-c()
for (i in 1:1000){
doors<-c(1,0,0)
ChoiceOne<-sample(Doors,3)
if(ChoiceOne==0){
FinalDoors<-c(ChoiceOne,ChoiceOne)
} else{
FinalDoors<-c(ChoiceOne,ChoiceOne)
}
SwitchWin<-c(SwitchWin,FinalDoors)
}
sum(SwitchWin)/length(SwitchWin)
``````
3. Encrypt and Decrypt the Alphabet
``````alphabet="abcdefghijklmnopqrstuvwxyz"
alphabet<-strsplit(alphabet,"")[]
randomAlphabet<-sample(alphabet,26)
Dalpha<-data.frame(Index=seq(1,26),Alphabet<-alphabet,Ralphabet<-randomAlphabet)
inputText<-"hello how are you this morning"
delimitedText<-strsplit(inputText,"")[]
CodedText<-c()
for(i in delimitedText){
if(i!=" "){
CodedText<-c(CodedText,as.character(Dalpha[Dalpha\$Alphabet==i,]\$Ralphabet))
}else{
CodedText<-c(CodedText," ")
}
}

DecodedText<-c()
for(i in CodedText){
if(i!=" "){
DecodedText<-c(DecodedText,as.character(Dalpha[Dalpha\$Ralphabet==i,]\$Alphabet))
}else{
DecodedText<-c(DecodedText," ")
}
}
paste(delimitedText,collapse="")
paste(CodedText,collapse="")
paste(DecodedText,collapse="")
``````
4. The FizzBuzz Problem.
``````a<-seq(1:100)
b<-c()
for  (i in a){
if(i%%3==0 && i%%5 == 0){
b<-c(b,"fizzbuzz")
}else if(i%%3==0){
b<-c(b,"fizz")
} else if(i%%5==0){
b<-c(b,"buzz")
} else {
b<-c(b,i)
}
}
b
``````
5. mean
``````myMean<-function(input){
return(sum(input)/length(input))
}
``````
6. Generate 100 random numbers
``````runif(100,0,1)
``````
7. List all of the prime numbers from 1 to 1000.
``````a<-seq(1,1000)
b<-c()
for (i in 2:499){
b<-c(a[a<=i],a[a>i & a%% i >0])
a<-b
}
b
``````
8. List all of the odd numbers from 1 to 100.
``````a<-seq(1,100)
a[a %% 2 ==TRUE]
``````
9. Write a function to find the sum of all integers between any two values.
``````find_sum <- function(first,second) {
return(sum(seq(first,second,1)))
}
``````
10. Find the sum of all the integer numbers from 1 to 100.
``````sum(seq(1,100,1))
``````
11. Write code that will place the numbers 1 to 100 separately into a variable using for loop. Then, again using the seq function.
``````my_variable <- c()
for (i in 1:100){
my_variable<-c(my_variable,i)
}
``````

or

``````a <- seq(1,100,1)
``````
12. Put numbers into variables, do simple math on the variables
``````a <- 1
b <- 2
c <- a+b
``````
13. Do simple math with numbers, addition, subtraction, multiplication, division
``````1+1
2/4
1-4
3*5
``````
14. Chapter 3 Programming Challenges I: Learning the fundamentals

I will be adding example problem solutions over time.

#### URL

10. crumplab.github.io crumplab.github.io
1. This chapter gives a brief tutorial on using the free and open-source programming language LIVECODE for programming behavioral experiments for cognitive research. The tutorial will cover some basic LIVECODE operations, programming a Stroop experiment, and scripts for preliminary data-analysis.

test tag...

Doing some tests with the r package hypothesisr, super convenient way to get all the annotation data from pages within a url.

#### URL

11. crumplab.github.io crumplab.github.io