R as.character()

1 개요[ | ]

R as.character()
as.character(42)
## [1] "42"
as(42, "character")
## [1] "42"
class(42)
## [1] "numeric"
class(as.character(42))
## [1] "character"
as.character(NA)
## [1] NA
as.character(NULL)
## character(0)
x <- as.Date("2019-01-01")+100
x
## [1] "2019-04-11"
class( x )
## [1] "Date"
as.character(x)
## [1] "2019-04-11"
class( as.character(x) )
## [1] "character"
mydf = iris[seq(1, nrow(iris), 20),]

mydf$Species
## [1] setosa     setosa     setosa     versicolor versicolor virginica  virginica 
## [8] virginica 
## Levels: setosa versicolor virginica

as.character(mydf$Species)
## [1] "setosa"     "setosa"     "setosa"     "versicolor" "versicolor"
## [6] "virginica"  "virginica"  "virginica"

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}