[R-SIG-Finance] hist from a data frame that is a list

Brian G. Peterson br|@n @end|ng |rom br@verock@com
Thu Jul 30 20:28:47 CEST 2020


In the future, please direct general R questions to stack orverflow or
the general R-help list.  This question is for Finance and finance-
related packages.

try:

hist(bwchist$reval)

If that doesn't work, try 

class(bwchist)

I suspect that the long list of tidyverse packages in your prior emails
may have led you astray, and basic things won't work.

Regards,

Brian


On Thu, 2020-07-30 at 20:18 +0200, Pedro páramo wrote:
> Hi all,
> 
> I have made some calculus and creating this:
> 
> 
> bwfinal <- matrix(bestworst, nrow =35 , ncol = 1)
> bwfinal2 <- matrix(namebw, nrow =35 , ncol = 1)
> 
> bwc<-cbind(bwfinal2,bwfinal)
> colnames(bwc)=c("Accion","reval")
> bwc <- as.data.frame(bwc)
> colnames(bwchist)=c("Accion","reval")
> bwchist <-as.data.frame(bwc[order(bwc$reval), ])
> 
> It is supposed thar bwchist is a data frame but when I try to make an
> hist
> it says me
> 
> Error in hist.default(bwchist) : 'x' must be numeric
> 
> It looks like bwchist is a list but dont I have tried to use unnlist
> but
> always appears the same error
> 
> My bwchist is like this when run on the command line How should I
> treat
> this data frame to hist Accio on x axis and values of reval on Y
> axis?:
> 
>  bwchist
>           Accion       reval
> 20           IAG  -0.6962448
> 7       Sabadell  -0.6788028
> 22         Melia  -0.5636132
> 26        Repsol  -0.4645528
> 23        Merlin  -0.4545645
> 8      Santander  -0.4368512
> 5  ArcelorMittal  -0.3847631
> 6           BBVA  -0.3774718
> 4        Amadeus  -0.3755909
> 28    Telefonica  -0.3598171
> 35         Indra   -0.358055
> 2            ACS   -0.354641
> 34      Almirall  -0.3510929
> 19      Colonial  -0.3501759
> 32           CIE   -0.315845
> 9      Bankinter  -0.2999523
> 21        Mapfre  -0.2913895
> 3           Aena  -0.2759459
> 31        Bankia   -0.262466
> 10     CaixaBank  -0.2539538
> 18       Inditex  -0.2505565
> 13          ENCE  -0.2414169
> 24       Naturgy  -0.2409723
> 30      Acerinox  -0.1881223
> 16       Grifols  -0.1819918
> 15     Ferrovial   -0.173434
> 12        Enagas  -0.0312891
> 25           REE 0.006016704
> 1        Acciona  0.04221062
> 14        Endesa  0.07195485
> 33      MasMovil   0.1120944
> 27       SGamesa   0.2178233
> 29      Viscofan    0.245229
> 17     Iberdrola   0.2585861
> 11       Cellnex    0.429028
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Finance using r-project.org
>  mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> 
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R
> questions should go.
-- 
Brian G. Peterson
ph: +1.773.459.4973
im: bgpbraverock



More information about the R-SIG-Finance mailing list