Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
326 views
in Technique[技术] by (71.8m points)

r - Could not find function "describe" (doing descriptive stats analysis)

I'm getting the following error message when attempting descriptive statistical analysis...

library(tidyverse)
library(dplyr)

data.frame(
                   row.names = c("Mazda RX4",
                                 "Mazda RX4 Wag","Datsun 710",
                                 "Hornet 4 Drive","Hornet Sportabout","Valiant",
                                 "Duster 360","Merc 240D"),
         mpg = c(21, 21, 22.8, 21.4, 18.7, 18.1, 14.3, 24.4),
         cyl = c(6, 6, 4, 6, 8, 6, 8, 4),
          hp = c(110, 110, 93, 110, 175, 105, 245, 62)
                )
#>                    mpg cyl  hp
#> Mazda RX4         21.0   6 110
#> Mazda RX4 Wag     21.0   6 110
#> Datsun 710        22.8   4  93
#> Hornet 4 Drive    21.4   6 110
#> Hornet Sportabout 18.7   8 175
#> Valiant           18.1   6 105
#> Duster 360        14.3   8 245
#> Merc 240D         24.4   4  62

describe(mtcars,
         mean_mpg = mean(mpg),
         sd_mpg = sd(mpg))
#> Error in describe(mtcars, mean_mpg = mean(mpg), sd_mpg = sd(mpg)): could not find function "describe"

How do I solves this?

question from:https://stackoverflow.com/questions/65918257/could-not-find-function-describe-doing-descriptive-stats-analysis

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Use library(psych) describe(mtcars) Gives below description as shown enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...