[英]R changes symbols inside column names when reading csv
不是 100% 確定你的意思,但如果你的數據在一個看起來像你的摘錄的文本文件中,並且你想使用read.csv()
將它加載到 R 中,我認為這會得到你想要的:
read.csv(
file = "data.txt",
sep = "|",
header = FALSE,
col.names = c("city", "type", "year_opened", "active"),
colClasses = c("active" = "logical")
)
city type year_opened active
1 Barcelona Standard 2012 TRUE
2 Berlin One 2013 TRUE
3 London One 2014 TRUE
4 Barcelona Standard 2015 TRUE
5 Berlin One 2016 TRUE
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.