[R] hist from a list

Pedro páramo percent||101 @end|ng |rom gm@||@com
Thu Jul 30 22:16:18 CEST 2020


Hi all,

I attach my code, the think is I want to make a bar plot the last variable
called "bwchist"

 so the X axis are "Accion" and the y axis are "reval" values.

I have prove class(bwchist) and says dataframe but its still a list because
it says me

I have prove to unlist,  but it doesnt work

hist(bwchist)
Error in hist.default(bwchist) : 'x' must be numeric

Or

barplot(bwchist)
Error in barplot.default(bwchist) : 'height' must be a vector or a matrix

library(PerformanceAnalytics)
library(dplyr)
library(tibble)
library(lubridate)
library(PerformanceAnalytics)
library(quantmod)
library(ggplot2)
library(png)
library(grid)
library(RCurl)
library(tidyquant)
library(timetk)
library(data.table)



Acciona<- tq_get("ANA.MC",from = '2019-12-31',get = "stock.prices")
ACS<- tq_get("ACS.MC",from = '2019-12-31',get = "stock.prices")
Aena<- tq_get("AENA.MC",from = '2019-12-31',get = "stock.prices")
Amadeus<- tq_get("AMS.MC",from = '2019-12-31',get = "stock.prices")
ArcelorMittal<- tq_get("MTS.MC",from = '2019-12-31',get = "stock.prices")
BBVA<- tq_get("BBVA.MC",from = '2019-12-31',get = "stock.prices")
Sabadell<- tq_get("SAB.MC",from = '2019-12-31',get = "stock.prices")
Santander<- tq_get("SAN.MC",from = '2019-12-31',get = "stock.prices")
Bankinter<- tq_get("BKT.MC",from = '2019-12-31',get = "stock.prices")
CaixaBank<- tq_get("CABK.MC",from = '2019-12-31',get = "stock.prices")
Cellnex<- tq_get("CLNX.MC",from = '2019-12-31',get = "stock.prices")
Enagas<- tq_get("ENG.MC",from = '2019-12-31',get = "stock.prices")
ENCE<- tq_get("ENC.MC",from = '2019-12-31',get = "stock.prices")
Endesa<- tq_get("ELE.MC",from = '2019-12-31',get = "stock.prices")
Ferrovial<- tq_get("FER.MC",from = '2019-12-31',get = "stock.prices")
Grifols<- tq_get("GRF.MC",from = '2019-12-31',get = "stock.prices")
Iberdrola<- tq_get("IBE.MC",from = '2019-12-31',get = "stock.prices")
Inditex<- tq_get("ITX.MC",from = '2019-12-31',get = "stock.prices")
Colonial<- tq_get("COL.MC",from = '2019-12-31',get = "stock.prices")
IAG<- tq_get("IAG.MC",from = '2019-12-31',get = "stock.prices")
Mapfre<- tq_get("MAP.MC",from = '2019-12-31',get = "stock.prices")
Melia<- tq_get("MEL.MC",from = '2019-12-31',get = "stock.prices")
Merlin<- tq_get("MRL.MC",from = '2019-12-31',get = "stock.prices")
Naturgy<- tq_get("NTGY.MC",from = '2019-12-31',get = "stock.prices")
REE<- tq_get("REE.MC",from = '2019-12-31',get = "stock.prices")
Repsol<- tq_get("REP.MC",from = '2019-12-31',get = "stock.prices")
SGamesa<- tq_get("SGRE.MC",from = '2019-12-31',get = "stock.prices")
Telefonica<- tq_get("TEF.MC",from = '2019-12-31',get = "stock.prices")
Viscofan<- tq_get("VIS.MC",from = '2019-12-31',get = "stock.prices")
Acerinox<- tq_get("ACX.MC",from = '2019-12-31',get = "stock.prices")
Bankia<- tq_get("BKIA.MC",from = '2019-12-31',get = "stock.prices")
CIE<- tq_get("CIE.MC",from = '2019-12-31',get = "stock.prices")
MasMovil<- tq_get("MAS.MC",from = '2019-12-31',get = "stock.prices")
Almirall<- tq_get("ALM.MC",from = '2019-12-31',get = "stock.prices")
Indra<- tq_get("IDR.MC",from ='2019-12-31',get = "stock.prices")

Indra_daily_returns <- Indra %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Indra_cum_returns <- Indra_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Almirall_daily_returns <- Almirall %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Almirall_cum_returns <- Almirall_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Acciona_daily_returns <- Acciona %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Acciona_cum_returns <- Acciona_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

ACS_daily_returns <- ACS %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
ACS_cum_returns <- ACS_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Aena_daily_returns <- Aena %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Aena_cum_returns <- Aena_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Amadeus_daily_returns <- Amadeus %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Amadeus_cum_returns <- Amadeus_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

ArcelorMittal_daily_returns <- ArcelorMittal %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
ArcelorMittal_cum_returns <- ArcelorMittal_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

BBVA_daily_returns <- BBVA %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
BBVA_cum_returns <- BBVA_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)


Sabadell_daily_returns <- Sabadell %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Sabadell_cum_returns <- Sabadell_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Santander_daily_returns <- Santander %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Santander_cum_returns <- Santander_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)


Bankinter_daily_returns <- Bankinter %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Bankinter_cum_returns <- Bankinter_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

CaixaBank_daily_returns <- CaixaBank %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
CaixaBank_cum_returns <- CaixaBank_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Cellnex_daily_returns <- Cellnex %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Cellnex_cum_returns <- Cellnex_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

CIE_daily_returns <- CIE %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
CIE_cum_returns <- CIE_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

CIE_daily_returns <- CIE %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
CIE_cum_returns <- CIE_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Enagas_daily_returns <- Enagas %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Enagas_cum_returns <- Enagas_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)


ENCE_daily_returns <- ENCE %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
ENCE_cum_returns <- ENCE_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)
Endesa_daily_returns <- Endesa %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Endesa_cum_returns <- Endesa_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)
Ferrovial_daily_returns <- Ferrovial %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Ferrovial_cum_returns <- Ferrovial_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Grifols_daily_returns <- Grifols %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Grifols_cum_returns <- Grifols_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Iberdrola_daily_returns <- Iberdrola %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Iberdrola_cum_returns <- Iberdrola_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Inditex_daily_returns <- Inditex %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Inditex_cum_returns <- Inditex_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Colonial_daily_returns <- Colonial %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Colonial_cum_returns <- Colonial_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

IAG_daily_returns <- IAG %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
IAG_cum_returns <- IAG_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Mapfre_daily_returns <- Mapfre %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Mapfre_cum_returns <- Mapfre_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Melia_daily_returns <- Melia %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Melia_cum_returns <- Melia_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Merlin_daily_returns <- Merlin %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Merlin_cum_returns <- Merlin_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Naturgy_daily_returns <- Naturgy %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Naturgy_cum_returns <- Naturgy_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

REE_daily_returns <- REE %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
REE_cum_returns <- REE_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Repsol_daily_returns <- Repsol %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Repsol_cum_returns <- Repsol_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

SGamesa_daily_returns <- SGamesa %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
SGamesa_cum_returns <- SGamesa_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Telefonica_daily_returns <- Telefonica %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Telefonica_cum_returns <- Telefonica_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Viscofan_daily_returns <- Viscofan %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Viscofan_cum_returns <- Viscofan_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Acerinox_daily_returns <- Acerinox %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Acerinox_cum_returns <- Acerinox_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)


Bankia_daily_returns <- Bankia %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Bankia_cum_returns <- Bankia_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

MasMovil_daily_returns <- MasMovil %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
MasMovil_cum_returns <- MasMovil_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

Indra_daily_returns <- Indra %>%
  tq_transmute(select = adjusted,           # this specifies which column
to select
               mutate_fun = periodReturn,   # This specifies what to do
with that column
               period = "daily",      # This argument calculates Daily
returns
               col_rename = "idr_returns") # renames the column
Indra_cum_returns <- Indra_daily_returns %>%
  mutate(cr = cumprod(1 + idr_returns)) %>%      # using the cumprod
function
  mutate(cumulative_returns = cr - 1)

bestworst<-c(Acciona_cum_returns[nrow(Acciona_cum_returns),4],
             ACS_cum_returns[nrow(ACS_cum_returns),4],
             Aena_cum_returns[nrow(Aena_cum_returns),4],
             Amadeus_cum_returns[nrow(Amadeus_cum_returns),4],
             ArcelorMittal_cum_returns[nrow(ArcelorMittal_cum_returns),4],
             BBVA_cum_returns[nrow(BBVA_cum_returns),4],
             Sabadell_cum_returns[nrow(Sabadell_cum_returns),4],
             Santander_cum_returns[nrow(Santander_cum_returns),4],
             Bankinter_cum_returns[nrow(Bankinter_cum_returns),4],
             CaixaBank_cum_returns[nrow(CaixaBank_cum_returns),4],
             Cellnex_cum_returns[nrow(Cellnex_cum_returns),4],
             Enagas_cum_returns[nrow(Enagas_cum_returns),4],
             ENCE_cum_returns[nrow(ENCE_cum_returns),4],
             Endesa_cum_returns[nrow(Endesa_cum_returns),4],
             Ferrovial_cum_returns[nrow(Ferrovial_cum_returns),4],
             Grifols_cum_returns[nrow(Grifols_cum_returns),4],
             Iberdrola_cum_returns[nrow(Iberdrola_cum_returns),4],
             Inditex_cum_returns[nrow(Inditex_cum_returns),4],
             Colonial_cum_returns[nrow(Colonial_cum_returns),4],
             IAG_cum_returns[nrow(IAG_cum_returns),4],
             Mapfre_cum_returns[nrow(Mapfre_cum_returns),4],
             Melia_cum_returns[nrow(Melia_cum_returns),4],
             Merlin_cum_returns[nrow(Merlin_cum_returns),4],
             Naturgy_cum_returns[nrow(Naturgy_cum_returns),4],
             REE_cum_returns[nrow(REE_cum_returns),4],
             Repsol_cum_returns[nrow(Repsol_cum_returns),4],
             SGamesa_cum_returns[nrow(SGamesa_cum_returns),4],
             Telefonica_cum_returns[nrow(Telefonica_cum_returns),4],
             Viscofan_cum_returns[nrow(Viscofan_cum_returns),4],
             Acerinox_cum_returns[nrow(Acerinox_cum_returns),4],
             Bankia_cum_returns[nrow(Bankia_cum_returns),4],
             CIE_cum_returns[nrow(CIE_cum_returns),4],
             MasMovil_cum_returns[nrow(MasMovil_cum_returns),4],
             Almirall_cum_returns[nrow(Almirall_cum_returns),4],
             Indra_cum_returns[nrow(Indra_cum_returns),4])

namebw<-c("Acciona",
          "ACS",
          "Aena",
              "Amadeus",
          "ArcelorMittal",
          "BBVA",
          "Sabadell",
          "Santander",
          "Bankinter",
          "CaixaBank",
          "Cellnex",
               "Enagas",
          "ENCE",
               "Endesa",
          "Ferrovial",
               "Grifols",
          "Iberdrola",
               "Inditex",
          "Colonial",
               "IAG",
          "Mapfre",
               "Melia",
          "Merlin",
               "Naturgy",
          "REE",
               "Repsol",
          "SGamesa",
               "Telefonica",
          "Viscofan",
               "Acerinox",
          "Bankia",
               "CIE",
          "MasMovil",
               "Almirall",
          "Indra")


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), ])

	[[alternative HTML version deleted]]



More information about the R-help mailing list