R as()

1 개요[ | ]

R as()
  • 객체를 지정한 클래스로 형 변환
123
#[1] 123
class(123)
#[1] "numeric"

as(123, "character")
#[1] "123"
class(as(123, "character"))
#[1] "character"
"123"
#[1] "123"
class("123")
#[1] "character"

as("123","numeric")
#[1] 123
class(as("123", "numeric"))
#[1] "numeric"
class(BOD)
#[1] "data.frame"
class(as(BOD,"data.frame"))
#[1] "data.frame"
class(as(BOD,"list"))
#[1] "list"
class(as(BOD,"vector"))
#[1] "list"
as(BOD,"data.frame")
#  Time demand
#1    1    8.3
#2    2   10.3
#3    3   19.0
#4    4   16.0
#5    5   15.6
#6    7   19.8

as(BOD,"list")
#[[1]]
#[1] 1 2 3 4 5 7
#
#[[2]]
#[1]  8.3 10.3 19.0 16.0 15.6 19.8

2 같이 보기[ | ]

3 참고[ | ]

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