1
Let’s say I have a data.frame
6x5, for example:
print(Dados)
Linha A B C D E
L1 4 3 2 2 4
L2 1 11 1 1 1
L3 0 1 2 3 4
L4 2 0 0 8 0
But I want to exclude the "head" of data.frame
, i.e., exclude the names of all variables, example:
print(Dados_Sem_Cabeça)
L1 4 3 2 2 4
L2 1 11 1 1 1
L3 0 1 2 3 4
L4 2 0 0 8 0
And then I would like to create a "new head" with different variable names, example:
print(Dados_Cabeça_Nova)
C1 C2 C3 C4 C5 C6
L1 4 3 2 2 4
L2 1 11 1 1 1
L3 0 1 2 3 4
L4 2 0 0 8 0
NOTE: I cannot select the names of the variables because when the data.frame
undergo updates the names of the variables will change, example:
print(Dados_Atualizados)
Linha B C D E F
L1 4 3 2 2 4
L2 1 11 1 1 1
L3 0 1 2 3 4
L4 2 0 0 8 0
How can I delete and then create all variable names in one data.frame
?
Thank you for the reply @Guilherme Parreira. But in my case I can’t use variable names because with each update of the data.frame they change. I edited the question by adding this little detail.
– Izak Mandrak
pq vc need to delete the actual names?
– Guilherme Parreira
Pq I cannot select for example the variable "A", pq in the next update the variable changes. Example:
Variáveis_Hoje = A, B, C, D, E
and then changes toVariáveis_Amanhã: B,C,D,E,F
. If I select by name "A" in the next update my script will give error, pq the variable "A" will no longer exist.– Izak Mandrak
The idea of deleting the "head" of the data.frame is to make sure that my script does not depend on the names of the variables that always change.
– Izak Mandrak
um, got it, so it’s using the
NULL
same. because then you can’t call the column name directly.– Guilherme Parreira
How can I use the
NULL
? And how to add the line with other variable names? You can edit your answer by clarifying please?– Izak Mandrak
but I edited my answer with the
NULL
– Guilherme Parreira
Let’s go continue this discussion in chat.
– Izak Mandrak