List of R commands

List of R commands




*name of new variable*<-c(value,value,value,......more values)

Assigning a variable based on a value or a string of values.

*name of new variable*<-*data or more values*

Assigning a variable to a dataset or other value.

attach(*variable*)

Making a matrix of a variable of a dataset.

min(*variable*) or min(*variable*, *vraibale* ….more variables)

Finding the minimum value from a variable or from a string of variables.

max(*variable*) or max(*variable*, *variable* ….more variables)

Finding the maximum value from a variable or string of variables.

lenght(*variable*)

Showing the number of values of a variable.

sum(*variable*)

The sum of all values of a specific variable.

mean(*variable*)

Showing the mean (average) of the values from a variable.

sd(*variable*)

Showing the standard deviation of the values from a variable.
detach(*variabele*)
Detach a matrix from a variable.

median(*variabele*)

Calculating the median from the values that a variable contains.

cor(*variabele1*, *variabele2*)

Showing the correlation between two variables.

plot(*variabele1*, *variabele2*)

Plotting a graph from two variables.

hist(*variabele*)

Making a histogram of a variable.

Making a boxplot of a variable.

barplot(*variable 1*, *variable 2*, more variables)

Making a bar graph of variables.

dotplot(*variable 1*, *variable 2*)

Making a dot plot of two variables.

pie(*variable*)

Making a pie chart of a variable.

*variable*[*position or name of variable 1*, *position or name of variable 2*]

Finding a value in the matrix of a variable.

read.csv(‘*name of a csv-file*’)

Importing a csv-file in R.

*name of the regression*<-lm(*dependent variable*~*independent variable 1*+*independent variable 2*+*more independent variables*)

Making a regression analysis with a dependent varaibele or one of more independent variables.

summary(*name of the regression*)

Showing the results and data of the regression analysis.

No comments:

Post a Comment