[R] benchmark-dea
Jim Lemon
drjimlemon at gmail.com
Mon Jun 20 00:45:20 CEST 2016
Hi farzana,
You can't, because it doesn't fit into the definition of a CSV file.
The "dea" function converts the nine element data frame "data1" into a
list, the elements of which are of different lengths. Therefore, it
can't be a data frame. Additionally, it can't be a matrix because its
elements are of different data types. A CSV file is a rectangular text
block in which the lines are interpreted as rows and the elements of
each row are separated by commas (or other specified separators). The
"Farrell" object is nothing like that. You can save it with the "save"
function and retrieve it with the "load" function, but you can't cram
it into a CSV file that can be retrieved later, and I think that is
what you are asking.
Jim
On Mon, Jun 20, 2016 at 4:43 AM, farzana akbari
<farzana.akbari2013 at gmail.com> wrote:
> hi Dear
> the first data that I used is data1 one as below
>
>
>> head(data1)
>
> firm indus bazar year y1 x1 x2 x3 x4
> 1 1 6 1 1382 117232 89110 3975 106 30198
> 2 1 6 1 1383 159865 121072 5399 109 35208
> 3 1 6 1 1384 181653 126703 7597 109 36442
> 4 1 6 1 1385 242900 163429 12768 109 41974
> 5 1 6 1 1386 341478 229209 11081 109 50036
> 6 1 6 1 1387 403594 268295 14581 109 57970
>> summary(data1)
> firm indus bazar year y1
> x1 x2 x3 x4
> Min. : 1.00 Min. :1.000 Min. :0.0000 Min. :1382 Min. :
> 0 Min. : 45 Min. : 254 Min. : 13 Min. :
> 134
> 1st Qu.: 43.00 1st Qu.:1.000 1st Qu.:1.0000 1st Qu.:1385 1st Qu.:
> 139218 1st Qu.: 139788 1st Qu.: 11790 1st Qu.: 2452 1st
> Qu.: 43231
> Median : 85.00 Median :4.000 Median :1.0000 Median :1388 Median :
> 405936 Median : 394484 Median : 27708 Median : 405576 Median
> : 129125
> Mean : 85.74 Mean :3.371 Mean :0.9165 Mean :1388 Mean :
> 3588140 Mean : 74125965 Mean : 32702944 Mean :489595378 Mean
> : 36749864
> 3rd Qu.:129.00 3rd Qu.:4.000 3rd Qu.:1.0000 3rd Qu.:1391 3rd Qu.:
> 1244035 3rd Qu.: 1406170 3rd Qu.: 77408 3rd Qu.:999999999 3rd
> Qu.: 472913
> Max. :170.00 Max. :6.000 Max. :1.0000 Max. :1393 Max.
> :400779395 Max. :999999999 Max. :999999999 Max. :999999999
> Max. :999999999
>> sapply(data1,sd)
> firm indus bazar year y1
> x1 x2 x3 x4
> 4.913015e+01 1.814535e+00 2.766475e-01 3.470185e+00 1.928340e+07
> 2.571194e+08 1.775295e+08 4.999911e+08 1.852238e+08
>
>
>> is.data.frame(data1)
> [1] TRUE
>
>
>
>
>
> for dea I used
>
> x=with(data1, cbind(x1,x2,x3,x4))
> y=with(data1, cbind(y1))
> farzana=dea(x,y)
> farzana
>
>
> and also
>
>
>
>> str(farzana)
>
> List of 12
> $ eff : num [1:1965] 0.732 0.717 0.713 0.705 0.768 ...
> $ lambda : num [1:1965, 1:1965] 0 0 0 0 0 0 0 0 0 0 ...
> ..- attr(*, "dimnames")=List of 2
> .. ..$ : NULL
> .. ..$ : chr [1:1965] "L1" "L2" "L3" "L4" ...
> $ objval : num [1:1965] 0.732 0.717 0.713 0.705 0.768 ...
> $ RTS : chr "vrs"
> $ primal : NULL
> $ dual : NULL
> $ ux : NULL
> $ vy : NULL
> $ gamma :function (x)
> $ ORIENTATION: chr "in"
> $ TRANSPOSE : logi FALSE
> $ param : NULL
> - attr(*, "class")= chr "Farrell"
>
>
>
>
>
> but now
>
>
>> write.csv(farzana,'D:sajjaad.csv')
> Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors =
> stringsAsFactors) :
> cannot coerce class ""Farrell"" to a data.frame
>
>
> so haw can I save it as csv?
>
>
> best regards
>>
>>
>
> On Wed, Jun 15, 2016 at 12:50 PM, Jim Lemon <drjimlemon at gmail.com> wrote:
>>
>> Hi farzana,
>> Probably the first thing is to ascertain what the class of "farzana" might
>> be:
>>
>> class(farzana)
>>
>> Because "write.csv" expects "the object to be written, preferably a
>> matrix or data frame. If not, it is attempted to coerce x to a data
>> frame." to be the first argument. It seems that "farzana" is neither a
>> matrix nor a data frame and something for which there is no method to
>> convert it to one.
>>
>> The second thing to do is to try to work out what is inside "farzana":
>>
>> str(farzana)
>>
>> This will produce a summary of what is in there. _Maybe_ with that
>> summary you can figure out how to convert it into a data frame. If
>> not, you can always save the object:
>>
>> save(farzana,file="farzana.Rdata")
>>
>> and reload it later.
>>
>> Jiim
>>
>>
>> On Thu, Jun 16, 2016 at 5:47 AM, farzana akbari
>> <farzana.akbari2013 at gmail.com> wrote:
>> > in the name of God
>> >
>> >
>> > hi dear
>> >
>> > I use benchmark package to use of dea and when I wanna save my result
>> > as csv by this as below
>> > write.csv(farzana,'D:sajjaad.csv')
>> >
>> > I can not and the error is as below
>> >
>> >
>> > Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors
>> > =
>> > stringsAsFactors) :
>> > cannot coerce class ""Farrell"" to a data.frame
>> >
>> >
>> > what should I do ?
>> >
>> >
>> > best regards
>> > farzana
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide
>> > http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>
>
More information about the R-help
mailing list