R coding language Flashcards
How to create a value:
Name of the value <- value, for a set it must be c(a,b,c,d).
How to create a scatter graph:
plot (x value, y value)
How to change the limits of the graph axis:
xlim= c(a,b), ylim= c(c,d)
How to change the colour of the graph:
(…, col= “colour”,…)
How to title a graph:
(…,main=”title”,…)
Binomial PD:
dbinom (x, n, p)
Binomial CD:
pbinom (x, n, p)
Bar graph:
barplot (value function…)
Sum of binomial values
sum(dbinom(a:b, n, p)
P value for binomial distributions:
qbinom (p value, n, p)
Randomly generated deviates for binomial distribution:
rbinom (x, n, p)
Matrix:
New values <- matrix (values, rows, columns)
Data Frame:
value <- data.frame (ID=value, Name=value)
Binomial Distribution Graph:
barplot (bin.d, names=bin.d)
Histogram:
hist(values, prob=TRUE, …)
Factorial of a number:
Fact <- function(x) {if(x==0){return(1)}else{return(x*Fact(x-1))}}
Fact(5)
Explaining functions and values:
…
Specific number of breaks in a graph:
hist(…, breaks=20,…)