otra forma usando el paquete data.table ... los puse en desorden solo para mostrar que sustituye buscando el header correcto y no por la posicion (que tambien se puede):

setwd("/home/neo/Desktop/")
library(data.table)
dat <- fread("headers")
setnames(dat,c("b","d","c","a"),c("carga de batería","radiación","temperatura","pluvio mensual"))
dat
> dat
   pluvio mensual carga de batería temperatura radiación
1:              1                2           3         4
2:              5                6           7         8
3:              9               10          11        12


Saludos y suerte !!!!

eric.








On 04/20/2017 05:48 PM, Javier Valdes Cantallopts (DGA) wrote:
Hola  a todos

Primero que todo, gracias por todos los consejos, me han servido ene.



Mi pregunta es la siguiente:

Como armar una función lógica “SI” PARA CAMBIAR LOS NOMBRES A LOS HEADER

Por ejemplo, si tengo una tabla así;

a

        

b

        

c

        

d

1

        

3

        

4

        

6

2

        

4

        

6

        

7



a= “pluvio mensual”

b= “carga de batería”

c= “temperatura”

d= “radiación”.

/La idea es reemplazar, en el caso que el HEADER sea (a), QUE EL NOMBRE
DEL HEADER CAMBIE A “PLUVIO MENSUAL”/

/ /

*Se me ocurre DAR UNA INSTRUCCIÓN TIPO COLNAMES<-¿*

*Espero sus respuestas, saludos.*

/ /







Descripción: FIRMA3




------------------------------------------------------------------------

CONFIDENCIALIDAD: La información contenida en este mensaje y/o en los
archivos adjuntos es de carácter confidencial o privilegiada y está
destinada al uso exclusivo del emisor y/o de la persona o entidad a
quien va dirigida. Si usted no es el destinatario, cualquier
almacenamiento, divulgación, distribución o copia de esta información
está estrictamente prohibido y sancionado por la ley. Si recibió este
mensaje por error, por favor infórmenos inmediatamente respondiendo este
mismo mensaje y borre todos los archivos adjuntos. Gracias.

CONFIDENTIAL NOTE: The information transmitted in this message and/or
attachments is confidential and/or privileged and is intented only for
use of the person or entity to whom it is addressed. If you are not the
intended recipient, any retention, dissemination, distribution or copy
of this information is strictly prohibited and sanctioned by law. If you
received this message in error, please reply us this same message and
delete this message and all attachments. Thank you.


_______________________________________________
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


--
Forest Engineer
Master in Environmental and Natural Resource Economics
Master in Sciences of Natural Resources
Dr.(c) Sciences of Natural Resources at La Frontera University
Member in AguaDeTemu2030, citizen movement for Temuco with green city standards for living

Nota: Las tildes se han omitido para asegurar compatibilidad con algunos lectores de correo.

_______________________________________________
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

Responder a