guido-s / meta

Official Git repository of R package meta
http://cran.r-project.org/web/packages/meta/index.html
GNU General Public License v2.0
82 stars 32 forks source link

Bubble plot issue after conducting meta-regression #12

Closed meettanmaysinha closed 5 years ago

meettanmaysinha commented 5 years ago

Hi, I am trying to use the bubble plot to plot the results of my metaregression, and I get an error something like:

Error in get(covar.name) : object 'Covariate name' not found

I get the same error when covariates are categorical or numeric. The output of the metaregression itself is fine and I am able to print it.

Any ideas why this might be? Many thanks.

meettanmaysinha commented 5 years ago

It seems that the covariate needs to be a variable in the R environment - a dataframe column cannot be used directly.

Sinakazemian commented 1 year ago

I cannot thank you enough for writing the solution. I have been struggling with this issue for 3 hours and I couldn't solve this error. Thank you and wish you the best <3

ASOC01 commented 6 months ago

hi, I have come across this issue as well in my meta regression, except I don't know how to convert the dataframe column into a variable - any tips on how to do that? Currently the covariate is a data column from a dataset that i imported from excel

Sinakazemian commented 6 months ago

Hi, I have come across this issue as well in my meta regression, except I don't know how to convert the dataframe column into a variable - any tips on how to do that? Currently the covariate is a data column from a dataset that i imported from excel

Sure, I will try to explain it as easy as possible:

First you have to import your excel file so have to install a package. CODE: install.packages(readxl)

and load this package CODE: library(readxl)

Imagine your excel file name is ABC and you want to import it to R and name the imported dataset as "Database" CODE: Database <- read_excel("ABC.xlsx", sheet = "Optional")

now you want to import a column in your dataframe into a variable in R. for example we want to name that variable as "meta.covariate". Imagine your column name in your dataset is "column32" CODE: meta.covariate <- Database$column32

Now a whole column from your dataset is imported in R as a variable and you use that variable as a covariate in your metaregression code.

for example: CODE: metaregression.result <- metareg([An object of class meta], [Covariate which is the imported variable "meta.covariate", method.tau = "Selected method")

Please let me know if you have any questions about these steps.