Thanks in advance as I know this is an extremely basic question. Yet I am having trouble finding an answer.
I wanted to add a row to a dataframe where pre-defined columns receive a specific value. For example, if the original dataframe looks like this:
A B C D
Label1 0 1 4 2
Label2 0 0 0 0
Label3 2 1 0 0
I want to add the value of "20" in a new row called New.Label only to columns C & D such that:
A B C D
Label1 0 1 4 2
Label2 0 0 0 0
Label3 2 1 0 0
New.Label 0 0 20 20
In my actual situation, I have a .txt file containing hundreds of column names that exist in a matrix containing many thousands of columns, so I'm looking for a much needed shortcut :) I am most comfortable using R so something that works in R would be really appreciated!
Thanks in advance and sorry again for the basic nature of the question!