Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 208966

Changing an specific numeric error in a given variable

$
0
0

I want to change all the zeros (0) and 36.1 in a given variable to another number.

To give you a better picture, this is what i tried to do:

transacciones_diarias$TIPO_CAMBIO_POOL <- ifelse(transacciones_diarias$TIPO_CAMBIO_POOL %in% c(0,36.1) & transacciones_diarias$COD_TIPOMOV == "VENTA",
                                                 transacciones_diarias$MONTO_TIPOCAMBIOCOL-0.01,
                                                    ifelse(transacciones_diarias$TIPO_CAMBIO_POOL %in% c(0,36.1) & transacciones_diarias$COD_TIPOMOV == "COMPRA",
                                                           transacciones_diarias$MONTO_TIPOCAMBIOCOL+0.01,
                                                           transacciones_diarias$TIPO_CAMBIO_POOL),
                                                 transacciones_diarias$TIPO_CAMBIO_POOL)

The error is:

Error in ifelse(transacciones_diarias$TIPO_CAMBIO_POOL %in% c(0, 36.1) &  : 
  unused argument (transacciones_diarias$TIPO_CAMBIO_POOL)

Here is some sample data:

enter image description here

Expected result:

enter image description here


Viewing all articles
Browse latest Browse all 208966

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>