Tuesday 16 June 2015

Get the type of variable in R

Use “class(variable)” to get type of variable.

Use “eapply(.GlobalEnv,typeof)” to get the type of all variables.

> name <- "Krishna"
> ls()
[1] "clc"  "name"
> eapply(.GlobalEnv,typeof)
$name
[1] "character"

$clc
[1] "closure"

"clc" is a custom defined closure.

Prevoius                                                 Next                                                 Home

No comments:

Post a Comment