ve个基本或原子对象类教程.pdfVIP

  • 0
  • 0
  • 约1.69千字
  • 约 3页
  • 2024-04-02 发布于北京
  • 举报

Objects

Rhasfivebasicor“atomic”classesofobjects:

·character

·numeric(realnumbers)

·integer

·complex

·logical(True/False)

Themostbasicobjectisavector

·Avectorcanonlycontainobjectsofthesameclass

·BUT:Theoneexceptionisalist,whichisrepresentedasavectorbutcancontainobjectsof

differentclasses(indeed,that’susuallywhyweusethem)

Emptyvectorscanbecreatedwiththevector()function.

2/27

Numbers

·NumbersinRagenerallytreatedasnumericobjects(i.e.doubleprecisionrealnumbers)

·Ifyouexplicitlywantaninteger,youneedtospecifytheLsuffix

·Ex:Entering1givesyouanumericobject;entering1Lexplicitlygivesyouaninteger.

·ThereisalsoaspecialnumberInfwhichrepresentsinfinity;e.g.1/0;Infcanbeusedin

ordinarycalculations;e.g.1/Infis0

·ThevalueNaNrepresentsanundefinedvalue(“notanumber”);e.g.0/0;NaNcsobe

thoughtofasamissingvalue(moreonthatlater)

3/27

Attributes

Robjectscanhaveattributes

·names,dimnames

·dimensions(e.g.matrices,arrays)

·class

·length

·otheruser-definedattributes/metadata

Attributesofanobjectcanbeaccessedusingtheattributes()function.

4/27

文档评论(0)

1亿VIP精品文档

相关文档