R语言中面向对象编程系统及其独特之处.pdfVIP

  • 0
  • 0
  • 约1.85万字
  • 约 63页
  • 2026-01-30 发布于北京
  • 举报

R语言中面向对象编程系统及其独特之处.pdf

·Asystemfordoingobjectorientedprogramming

·Rwasoriginallyquiteinterestingbecauseitisbothinteractiveandhasasystemforobject

orientation.

-OtherlanguageswhichsupportOOP(C++,Java,Lisp,Python,Perl)generallyspeakingare

notinteractivelanguages

·InRmuchofthecodeforsupportingclasses/methodsiswrittenbyJohnChambershimself(the

creatoroftheoriginalSlanguage)anddocumentedinthebookProgrammingwithData:AGuide

totheSLanguage

·AnaturalextensionofChambers’ideaofallowingsomeonetocrosstheuser−→programmer

spectrum

·ObjectorientedprogrammingisabitdifferentinRthanitisinmostlanguages—evenifyouare

familiarwiththeidea,youmaywanttopayattentiontothedetails

S3类/方法

·包含在S语言的第3版中。

·非正式,有点儿凑合。

·有时被称为旧式类/方法。

S4类/方法

·更正式和严格。

·包含在S‑PLUS6和R1.4.0(2001年12月)中。

·也称为新式类/方法

S3classes/methods

·Includedwithversion3oftheSlanguage.

·Informal,alittlekludgey

·Sometimescalledold-styleclasses/methods

S4classes/methods

·moreformalandrigorous

·IncludedwithS-PLUS6andR1.4.0(December2001)

·Alsocallednew-styleclasses/methods

·目前(以及可预见的未来),S3类/方法和S4类/方法是两个独立的系统(但可以在一定程度上混

合使用)。

·每个系统可以相对独立地使用。

·鼓励新项目的开发者(你!)使用S4风格的类/方法。

-在Bioconductor项目中广泛使用

·但许多开发者仍然使用S3类/方法,因为它们“快速且简单”(并且更容易)。

·在这次讲座中,主要关注S4类/方法。

·在R中实现S4类/方法的代码位于methods包中,该包通常默认加载(但如果未加载,可以使用

加载)

·Fornow(andtheforseeablefuture),S3classes/methodsandS4classes/methodsareseparate

systems(buttheycanbemixedtosomedegree).

·Eachsystemcanbeusedfairlytlyoftheother.

·Developersofnewprojects(you!)areencouragedtousetheS4styleclasses/methods.

-UsedextensivelyintheBioconductorproject

·ButmanydevelopersstilluseS3classes/methodsbecausetheyare“quickanddirty”(andeasier).

·Inthislectur

文档评论(0)

1亿VIP精品文档

相关文档