Metodyczne myślenie

Programowanie obiektowe z S3 i R6 w R

Richie Cotton

Data Evangelist at DataCamp

ch2_2-methodical-thinking.003.png

Programowanie obiektowe z S3 i R6 w R
methods
Programowanie obiektowe z S3 i R6 w R
methods("mean") # or methods(mean)
mean.Date     mean.default  mean.difftime mean.POSIXct 
mean.POSIXlt 
see '?methods' for accessing help and source code
Programowanie obiektowe z S3 i R6 w R

ch2_2-methodical-thinking.009.png

Programowanie obiektowe z S3 i R6 w R
methods(class = "glm") # or methods(class = glm)
add1           anova          coerce        
confint        cooks.distance deviance      
drop1          effects        extractAIC    
family         formula        influence     
initialize     logLik         model.frame   
nobs           predict        print         
residuals      rstandard      rstudent      
show           slotsFromS3    summary       
vcov           weights       
see '?methods' for accessing help and source code
Programowanie obiektowe z S3 i R6 w R

 

 

 

methods() zwraca metody S3 i S4

Programowanie obiektowe z S3 i R6 w R
.S3methods(class = "glm")
add1           anova          confint       
cooks.distance deviance       drop1         
effects        extractAIC     family        
formula        influence      logLik        
model.frame    nobs           predict       
print          residuals      rstandard     
rstudent       summary        vcov          
weights       
see '?methods' for accessing help and source code
Programowanie obiektowe z S3 i R6 w R
.S4methods(class = "glm")
coerce      initialize  show        slotsFromS3
see '?methods' for accessing help and source code
Programowanie obiektowe z S3 i R6 w R

Podsumowanie

  • methods() znajduje metody dla generycznej
  • ... lub dla klasy
  • .S3methods() znajduje metody tylko S3
Programowanie obiektowe z S3 i R6 w R

Czas na ćwiczenia!

Programowanie obiektowe z S3 i R6 w R

Preparing Video For Download...