Description Usage Arguments Value Author(s) References Examples
View source: R/check.type.one.var.R
Receives a specific variable and return a number indicating its type. The variables can be 1 is integer, 2 is numeric, 3 is factor, 8 is character.
1 | check.type.one.var(data.to.work, show.message = 0, variable.name)
|
data.to.work |
is a data set containing the variables to be verified. |
show.message |
is a parameter indicating if the function will or not show a message. |
variable.name |
is the name of variable to be checked. |
A variable with the code indicating the type of variable and a message (or not).
Elias Carvalho
GUJARATI, Damodar N. Basic econometrics. Tata McGraw-Hill Education, 2009.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Clean environment
closeAllConnections()
rm(list=ls())
# Set enviroment
# setwd("to your working directory")
# Load packages
library(bnpa)
# Use working data sets from package
data(dataQuantC)
head(dataQuantC)
# Adding random data to dataQuantC, function will return TRUE
dataQuantC$Z <- round(runif(500, min=0, max=1000),2)
# Converting the numeric variable into factor
dataQuantC$Z <- factor(dataQuantC$Z)
# Check and return a numeric value correspondig to the variable type
# Set the variable name
variable.name = "A"
# identify the type
check.type.one.var(dataQuantC, show.message=0, variable.name)
# Set the variable name
variable.name = "Z"
# identify the type
check.type.one.var(dataQuantC, show.message=0, variable.name)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.