[R-meta] Fwd: Dataframe is character

Viechtbauer Wolfgang (SP) wolfgang.viechtbauer at maastrichtuniversity.nl
Fri Nov 17 11:26:23 CET 2017


Hi Roberto,

This is a bit off-topic here.

But class("dat") is checking the class of the string "dat", which is obviously of class character. You want to use class(dat). Also, class(yi) would not work, since yi is inside dat. So, it should be class(dat$yi).

Best,
Wolfgang

>-----Original Message-----
>From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-
>project.org] On Behalf Of P. Roberto Bakker
>Sent: Friday, 17 November, 2017 11:14
>To: r-sig-meta-analysis at r-project.org
>Subject: [R-meta] Fwd: Dataframe is character
>
>I resend my mail as I was not member of this list - now I am.
>Roberto
>
>---------- Forwarded message ----------
>From: P. Roberto Bakker <robertobakker at gmail.com>
>Date: 2017-11-17 10:41 GMT+01:00
>Subject: Dataframe is character
>To: r-help at r-project.org
>
>Hi everybody,
>
>Question: why are my dataframe and numeric variables a character?
>
>I read an excel file via readxl but my dataframe is a character, and
>numeric variables, eg "yi", are also a character.
>My excelfile is in English numeric
>Sometimes the dataframe was indeed a dataframe, but I do not know why it
>did sometimes.
>Thank you in advance, Roberto
>PS I used "guess". The problem is not solve by using "text", "numeric"
>etc
>
>My syntax (I think I cannot send the excel file as binary?)
>
>> library(readxl)
>> library(readxl)
>> library(metafor)
>> setwd("C:/docs/Work2/Statistic_Analyses/MetaQTcAD")
>> getwd()
>[1] "C:/docs/Work2/Statistic_Analyses/MetaQTcAD"
>>
>
>> dat <- read_excel("Hedges-g_QTc MA_R05.xlsx", sheet = 2,
>col_names=TRUE,
>col_types = c("guess"))
>> class("dat")
>[1] "character"
>> class("yi")
>[1] "character"



More information about the R-sig-meta-analysis mailing list