Tuesday, July 7, 2015

R programming - more about variables

Refer index page for R at the following URL:
http://mylearningcafe.blogspot.in/2015/07/r-programming-index-page.html

In the previous article, we saw how to assign and remove variables.
We shall continue a bit more on variables.

Since there are multiple data types, one can see the data types using certain functions
  • class(variable_name) gives the data type of the variable
  • is.numeric(variable_name) returns TRUE/FALSE based on the nature of the variable
  • nchar(variable_name) gives the count of the number of characters in the variable
  • ls() will list all the variables in your workspace
    • ls() returns character(0) if no variables are found
  • ls.str() will list more details of the variables in your workspace
  •  rm(list=ls()) can be used to remove all the variables in your workspace










Dates
Dates can be defined as

x<-as.Date("2015-07-20") [Note that D is capital]



Vectors are important data types in R.
We shall discuss more about vectors in upcoming articles.

Refer index page for R at the following URL:
http://mylearningcafe.blogspot.in/2015/07/r-programming-index-page.html

No comments:

Post a Comment