Strata R function not found (Ubuntu)

Asked

Viewed 440 times

2

Good afternoon, I’m studying R on Ubuntu (16.04 LTS). When trying to use the strata function via the command below:

amostra = strata(infert, c("education"), size = c(5, 48, 47), method = "srswor")

Error occurs below:

Error in strata(infert, c("Education"), size = c(5, 48, 47), method = "srswor") : could not find function "strata"

R version on Ubuntu R version 3.4.2 (2017-09-28) -- "Short Summer"

inserir a descrição da imagem aqui

1 answer

6

Some functions we use in R are not associated with base package. So we should install the package that developed the function we want using install.packages("nome do package") and then call the package using library(nome do package).

If you don’t know the package name, you can use the function findFn() of the package sos.

install.packages("sos") # se ainda não instalou o package
library(sos)

findFn("strata", maxPages = 1)

EDITED:

According to Rui Barradas, the package is probably sampling.

  • 1

    I did the same, with the package sos, but I think taking into account the arguments of the question function should come from the package sampling.

  • Cool, I edited the package suggestion. Thank you

  • Then you should include that in your reply, so you only removed the previous suggestion.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.