R programming.
Aim:
To learn about R
- data types
- variables
- operators
- control statements
- loops, r scripts
- Functions etc..
Data types in R:
R has variety of data types such as vector, matrices, numerical, logical, character, data frames etc..
a few examples are
vector:
a <- c(1,2,5.3,6,-2,4) # numeric vector
b <- c("one","two","three") # character vector
matrices:
all columns in a matrix must have same mode ( same charactes, same numerics) etc..
general format :
mymatrix <- matrix(vector, nrow= r, ncol= c, byrow= FALSE,
dimnames=list( char_vector_rownames, char_vector_colnames))
- unlike other prog languages, in r we could just print the variable or value holder by just naming it without adding a print statement to print it.
> x <- 5 ## nothing printed
> x ## auto-printing occurs
[1] 5
> print(x) ## explicit printing
[1] 5
Comments
Post a Comment