I can not run a command, with the "rDEA"

2

I'm a beginner in R and I do not understand much of the solutions in English. I believe, therefore, that a forum in Portuguese can help me.

I have the following database (date):

I'mtryingtorunthecommand:

##inputsandoutputsforanalysisY=data[c('V7','V8')]X=data[c('V3','V4','V5','V6')]W=data[('V2')]##Naiveinput-orientedDEAscoreforthefirst20firmsundervariablereturns-to-scalefirms=1:19di_naive=dea(XREF=X,YREF=Y,X=X[firms,],Y=Y[firms,],model="input", RTS="variable")
di_naive$thetaOpt
## Naive DEA score in cost-minimization model for the first 20 firms under variable returns-to-scale
ci_naive = dea(XREF=X, YREF=Y, X=X[firms,], Y=Y[firms,], W=W[firms,],
model="costmin", RTS="variable")
ci_naive$XOpt
ci_naive$gammaOpt

I am, however, receiving the following error message:

> library("rDEA", lib.loc="~/R/win-library/3.3")
Using the GLPK callable library version 4.47
> data <- read.delim("~/R/win-library/3.3/data.txt", header=FALSE)
>   View(data)
> ## inputs and outputs for analysis
> Y = data[c('V7', 'V8')]
> X = data[c('V3', 'V4','V5','V6')]
> W = data[('V2')]
> ## Naive input-oriented DEA score for the first 20 firms under variable returns-to-scale
> firms=1:19
> di_naive = dea(XREF=X, YREF=Y, X=X[firms,], Y=Y[firms,], model="input", RTS="variable")
Error in dea.input(XREF = XREF, YREF = YREF, X = X, Y = Y, RTS = RTS) : 
  YREF has to be numeric matrix or data.frame.
> di_naive$thetaOpt
Error: object 'di_naive' not found
> ## Naive DEA score in cost-minimization model for the first 20 firms under variable returns-to-scale
> ci_naive = dea(XREF=X, YREF=Y, X=X[firms,], Y=Y[firms,], W=W[firms,],
+                model="costmin", RTS="variable")
Error in dea.costmin(XREF = XREF, YREF = YREF, X = X, Y = Y, W = W, RTS = RTS) : 
  YREF has to be numeric matrix or data.frame.
> ci_naive$XOpt
Error: object 'ci_naive' not found
> ci_naive$gammaOpt
Error: object 'ci_naive' not found
    
asked by anonymous 30.01.2017 / 13:56

1 answer

1

The problem with your code is probably the import of the data.

The Y variable you create must be a data.frame with numeric columns or a numeric array. In the case, from what I could see from the image, it is as character , because of the º symbol that appears after the number.

One way to fix this is to use the parse_number function of apcote readr . So you would only get the numerical value of the variable and disregard the symbol of º that is disturbing you.

So, you can transform your data before doing so:

library(readr)
data$V7 <- parse_number(data$V7)
data$V8 <- parse_number(data$V8)

After running this will probably work. If you continue to see some error saying that some column is not numeric, look for issues like this in other columns of your database.

    
02.02.2017 / 14:44