Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikibooksThe Free Textbook Project
Search

Statistical Analysis: an Introduction using R/R/Lists

From Wikibooks, open books for an open world
<Statistical Analysis: an Introduction using R |R
R is very particular about what can be contained in a vector. All the elements need to be of the same type, an moreover must be either types of number[1], logical values, or strings of text[2].If you want a collection of elements which are of different types, or not of one of the allowed vector types, you need to use alist.
Input:
l1 <- list(a=1, b=1:3)l2 <- c(sqrt, log) #
Result:


Notes

[edit |edit source]
  1. There are actually 3 types of allowed numbers: "normal" numbers, complex numbers, and simple integers. This book deals almost exclusively with the first of these.
  2. This is not quite true, but unless you are a computer specialist, you are unlikely to use the final type: a vectors of elements storing "raw" computer bits, see?raw
Retrieved from "https://en.wikibooks.org/w/index.php?title=Statistical_Analysis:_an_Introduction_using_R/R/Lists&oldid=1577729"
Category:
Hidden category:

[8]ページ先頭

©2009-2025 Movatter.jp