Using Data function on own data set

I have created a data set that I can view but when attempting to use the function data() an error comes up as- Warning message:
In data(Brates) : data set ‘Brates’ not found

This is my data set:

Brates <- WDI(country = "CA", indicator = c('Birth_Rates' = 'SP.DYN.CBRT.IN','Un_fem' = "SL.UEM.TOTL.FE.NE.ZS",'Lforce_fem'= "SL.TLF.TOTL.FE.IN",
'HSgrad_fem' = "SE.TER.GRAD.ED.FE.ZS"),
start = 2010, end = 2017, extra = FALSE, cache = NULL)
save(Brates, file = "Brates.Rdata")
data(Brates)

System Information:

  • RStudio Edition: (Desktop or Server)
  • RStudio Version:
  • OS Version:
  • R Version:
  • sessionInfo():

Referred here from support.rstudio.com

Hi @sarahpaige1, welcome to RStudio Community.

I'm not sure exactly what you are trying to accomplish. WDI() returns a data frame so the Brates object is already present in your environment and ready for use.

If you are trying to read in the objects from the .Rdata file you saved, you need to use load("Brates.Rdata").

1 Like

Hi I’m trying to be able to use it for a regression

I'll repeat. Once you have called WDI() and stored the results of the query into the Brates object, it is ready for your use.

You can now run lm() or whatever other regression method you wish to use on the Brates data frame. You do not need to call save() or data().

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.