Hi everyone! I'm new to R and was wondering if anyone could provide any suggestions In my R program I am importing a data file that contains a column titled "Depth". The column is empty, so R is automatically adding NA to each row in the column. However, I would like to replace this NA with the string "Null". Does anyone know how to do this? I know how to do this if I create a new column, but I'm hoping to simply populate this column. Thank you in advance for any help you may be able to provide!
Not usually a good idea to do this, especially if depth is intended to (eventually?) hold numeric values, because filling the column with strings will make the column type chr. Also, don't use
Null, which could be confusing because it's not the same as
NULL. But here's how you'd replace a column
Depth in a data frame
dta["Depth"] <- "empty"
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.