1. 程式人生 > >R讀 txt 文件

R讀 txt 文件

clas rck 分隔符 ota 表示 community truct utf-8 post

house<-read.table("house_data.txt", header = TRUE, sep=‘|‘,fileEncoding =‘UTF-8‘)

id|house_customized_id|community_id|community_name|house_area|house_structure|house_floor|house_total|house_avg|house_tag|agency_name
6328500962692431872|3232_77_3室2廳_5.5|3232|尚東花園|77.0|3室2廳|5.5|285.0|37013.0|南北通透|利眾置業
6328500979813580800|1213_93_2室2廳_9.11|1213|賽世香樟園|93.0|2室2廳|9.11|265.0|28495.0|南北通透|蘇商房產仙林店

header = TRUE:表示第一行為列變量名
sep=‘|‘:見名知義,分隔符
fileEncoding =‘UTF-8‘:解決中文亂碼

R讀 txt 文件