- Define the function and label is mn
- Calculate the mean values for the function using a sequence from 1 to 100
Back
apply(country.data,2,max)
Front
- Compute the maximum values in each column
Back
x=1:10
y=20:30
z=c(x,y)
Front
- Create sequence called x from 1 to 10 in increments of 1
- Create sequence called y from 20 to 30 in increments of 1
- Concatenate the two into a sequence called z
Back
dimnames(country.data)=list(countries,variables)
Front
- Assign the previously created row and column names to the data
-First list value is row name, second is column name
Back
x=3:8
matrix(c,ncol=3,byrow=T)
Front
- Create a sequence from 3 to 8 with increment of 1
- Create a matrix with 3 columns, with sequence increasing by row and not by columns
Back
x=seq(1,20,5)
x>7
indx=x>10
Front
- Create sequence 1 to 20 in increments of 5
- True/False statements for values greater than 7 for the sequence
-
Back
country.data[1,2]=10
Front
- Replace the value in the first row and second column with 10
Back
colMeans(country.data)
Front
- Calculate the mean for each column of data
Back
rep(c(1,2,3),2)
Front
- Concatenate values 1, 2, and 3, and repeat it twice
1 2 3 1 2 3
- Create a matrix for the sequence 1 through 6, with two rows called x
- Create a matrix for the sequence 2 through 7, with two rows called y
- Bind the columns of y to x
- Bind the rows of y to x
Back
mean(rnorm(100))
Front
- Calculate the mean of a random 100 numbers
Back
country.data[2,]
country.data[,2]
Front
- Show all data in row 2
- Show all data in column 2
Back
x=seq(-5,25,length.out=50)
Front
- Sequence from -5 to 25 with 50 uniform increments
Back
x=rnorm(100)
plot(x,pnorm(x))
plot(x,dnorm(x))
Front
- Generate 100 random numbers
- Plot the distribution function
- Plot the density function
Back
x=1:10
y=2:11
x+y
x*y
x %% y
Front
- Create sequence called x from 1 to 10 in increments of 1
- Create sequence called y from 2 to 11 in increments of 1
- Add all matching x and y elements
- Multiply all matching x and y elements
- Multiply the two elements using matrix math (dot product)
Back
x=3:8
matrix(x,ncol=2)
Front
- Create a sequence from 3 to 8 with increment of 1
- Create matrix with 2 columns, number of rows dependent on the number of values