top of page
Search
  • Writer's picturetbeehoon

Creation vs Coercion

Updated: May 29, 2019

Was thinking about real-life event, the result of creation and coercion. And then I remembered this happens in R coding as well.

The method data.frame() is for creation, and as.data.frame() is to coerce.

The two methods may look the same and sometimes they produce the same output. But, they are different.

The function as.data.frame() is to check if an object is a data frame, or coerce it if possible.

The function data.frame() creates data frames, which is the fundamental data structure used by R.

Both are necessary and useful.









6 views0 comments

Recent Posts

See All
bottom of page