View source: R/HerramientasAutonomas.R
sustituirNAs | R Documentation |
Sustituye los NA por otro valor en un conjunto de datos
sustituirNAs(datos, sustituto = "·")
datos |
Un conjunto de datos que deben imprimir. Se esperan dataframes. |
sustituto |
El valor por el que se reemplazan los NA. Por defecto: ·. |
El conjunto de datos con los NAs sustituidos.
Jose Alejandro Morán Pérez
https://stackoverflow.com/questions/19516302/do-not-print-na-when-printing-data-frame
ejemplo <- iris[1:2, 1:2]
ejemplo
# Sepal.Length Sepal.Width
# 5.1 3.5
# 4.9 3.0
ejemplo[2, 2] <- NA
ejemplo
# Sepal.Length Sepal.Width
# 5.1 3.5
# 4.9 NA
sustituirNAs(ejemplo, "0")
# Sepal.Length Sepal.Width
# 5.1 3.5
# 4.9 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.