Could anyone explain how to change a single cell in a data.frame
to something else. Basically I just want to rename that one cell, not all cells which matches it. I can´t use the edit()
command because it will screw up my script since im using the data.frame
on several occasions.
Thanks in advance
Pandas DataFrame update() Method The update() method updates a DataFrame with elements from another similar object (like another DataFrame). Note: this method does NOT return a new DataFrame. The updating is done to the original DataFrame.
In the R Commander, you can click the Data set button to select a data set, and then click the Edit data set button. For more advanced data manipulation in R Commander, explore the Data menu, particularly the Data / Active data set and Data / Manage variables in active data set menus.
data.frame[row_number, column_number] = new_value
For example, if x
is your data.frame:
x[1, 4] = 5
Suppose your dataframe is df and you want to change gender from 2 to 1 in participant id 5 then you should determine the row by writing "==" as you can see
df["rowName", "columnName"] <- value df[df$serial.id==5, "gender"] <- 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With