Skip to content

Instantly share code, notes, and snippets.

@geofferyzh
Created April 16, 2012 20:53
Show Gist options
  • Select an option

  • Save geofferyzh/2401437 to your computer and use it in GitHub Desktop.

Select an option

Save geofferyzh/2401437 to your computer and use it in GitHub Desktop.
RinAction - R Data Manipulation - Data Type Conversion
##############################################################
## ------------ Data Type Conversion -------------
## Converting one data type to another
##
## is.numeric() --> as.numeric()
## is.character() --> as.character()
## is.vector() --> as.vector()
## is.matrix() --> as.matrix()
## is.data.frame() --> as.data.frame()
## is.factor() --> as.factor()
## is.logical --> as.logical()
##############################################################
a <- c(1, 2, 3)
a
is.numeric(a)
is.vector(a)
a <- as.character(a)
a
is.numeric(a)
is.vector(a)
is.character(a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment