[R] Remove line from data file

CALUM POLWART po|c1410 @end|ng |rom gm@||@com
Sun Sep 18 13:25:15 CEST 2022


From the file? Or the data frame once its loaded?

What format is the file? CSV?

Do you know the line that needs deleted?

mydf <- read.csv("myfile.csv")

mydf2 <- mydf[-columnName == "valuetodelete", ]
# Note the - infront of column name
# or perhaps columnName != "value to delete", ]

write.csv(mydf2, "mydeletedfile.csv")




On Sun, 18 Sep 2022, 10:33 Parkhurst, David, <parkhurs using indiana.edu> wrote:

> I’ve been retired since ‘06 and have forgotten most of R.  Now I have a
> use for it.  I’ve created a data file and need to delete one row from it.
> How do I do that?
>
> DFP (iPad)
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list