close
Write the built-in data set "airquality" to a Tab-separated text file with write.table. View it with a text editor (depending on your system). Change the NA value to . (period), and read the changed file back into R with a suitable command.
> write.table(airquality, "02.txt", sep="\t")
方法一
> a[is.na(a)]<-"."
> write.table(a, "02_with_period.txt", sep="\t")
> read.table(file = "02_with_period.txt")
方法二
> write.table(airquality, na = ".")
> read.table(file = "02.txt" , na.strings = ".")
文章標籤
全站熱搜