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 = ".")
arrow
arrow
    文章標籤
    R語言 生物統計
    全站熱搜

    猛犬 發表在 痞客邦 留言(0) 人氣()