无法在R

时间:2015-05-14 12:09:05

标签: r text

我有一个我试图阅读的文本数据集。但是,它没有给出正确的格式。

该数据集旨在了解不同类型的电影对大脑活动的影响。为此,我们在观看由属于14种不同类型电影的专家分类的电影后不久就对各种主题(ppl)进行了神经测量。数据集中的第一列对应于电影类型,数据集中的每一行由每个主题的各种神经测量序列组成。数据被转换为对数标度。

以下是文本文件前几行的示例。我认为整数是标题。那么有6830列(整数)。我正在展示前几个。之后我们就有了数据。有人可以帮助您明确地在单独的专栏中阅读这些内容吗?

"Genres" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "60" "61" "62" "63" "64" "65" "66" "67" "68" "69" "70" "71" "72" "73" "74" "75" "76" "77" "78" "79" "80" "81" "82"...
V1" "Action" "0.3" "1.18" "0.55" "1.14" "-0.265" "-0.07" "0.35" "-0.315" "-0.45" "-0.6549805" "-0.65" "-0.94" "0.31" "0.01500977" "-0.08" "-2.37" "-0.54" "-0.615" "0" "-0.5199902" "-0.37" "-0.29" "-0.1749903" "0.07" "-0.04" "0.025" "-0.74" "-0.4799903" "-0.45" "-0.93" "0.16" "-0.55" "-0.5500098" "0.055" "-0.37" "-0.165" "0.21" "0.47" "0" "-2.602085e-18" "0.1399805" "-0.215" "-0.065" "-0.225" "-0.35" "-1.335" "0" "0.2175" "0.25" "0.13" "-0.48" "-0.42" "-0.7" "-0.275" "-0.3449902" "-0.16" "-0.35" "0.555" "0.29" "-0.27" "-0.3399805" "0.305" "-0.005" "0.7" "0.4500195" "0.21" "0.29" "0.08499023" "-0.4550098" "0.12" "-0.66" "0.1" "0.1" "-0.09996101" "-0.3999805" "-0.195" "0.28" "2.36" "0.47" "0.18" "-0.6449902" "1.3" "0" "-0.48" "0.595" "-0.05998047" "0.055" "0.0975" "0.4" "0.28" "0.76" "1.425" "-0.51" "0.94" "0.94" "0.68" "-0.21" "-1.19" "0" "0" "0.91" "0.05" "-0.03" "-0.06" "-0.08" "-0.13" "1.3325" "0.8500195" "1.45" "1.02499" "-0.92" "-0.225" "0.35" "0.3450098" "0.24" "0.03" "-0.9975" "-1.184981" "0.2" "-0.55" "-0.6" "-0.84" "-0.28" "0" "0" "-0.035" "-1.305" "-1.07" "0.075" "-0.5550098" "0.23" "0.83" "0" "-0.33" "0" "0.33" "0.32" "1.79" "2.20999" "1.64" "0.65" "2.37" "2.675" "1.36" "-0.82" "0.795" "0.42" "-0.44" "-0.775" "0" "-0.225" "0.11" "1.17" "0.52" "-0.24" "-0.75" "-0.64" "-0.145" "-0.14" "-0.16" "-0.04" "0.145" "-0.31" "-0.0625" "-0.03" "-0.1450098" "-0.64" "-0.45" "0.4" "-1.065" "-0.57" "-0.42" "-0.22" "-0.05" "0.015" "-0.3200195" "0.39" "0.03" "0" "1.015" "0.9150098" "-0.33" "0.17" "0.27" "-0.02" "0.1" "0.37" "-1.4" "0" "0.155" "-0.005" "0" "1.3325" "-1.0475" "-0.239961" "-0.6749903" "-0.09498051" "-1.08" "-0.53" "0.01" "0.34" "-0.5" "-0.715" "0.25" "-0.1299805" "0.3375" "0.55" "-1.85001" "-0.4" "-0.04" "-0.73" "0.54" "-0.8999902" "0.680039" "-0.38" "-0.8375" "-0.005" "-0.555" "-0.31" "0.33" "0.17" "0.1" "1.06" "-1.09002" "-1.62" "0.03" "-0.16" "-0.01" "-0.49" "-0.535" "-0.305" "-0.6049902" "0.18" "0.89" "0.255" "0.25" "0.01" "-0.8" "-0.18" "0.0075" "-0.325" "0.055" "-0.65" "0.56" "-0.2" "0.65" "-1.71" "0.58" "-1.00002" "-1.24" "-1.1" "-1.39" "-1.36" "-2.25" "0" "-1.91" "-1.03" "

1 个答案:

答案 0 :(得分:0)

你的例子似乎工作得很好......

dat <- '"Genres" "1" "2" "3" "4" "5"
"V1" "Action" "0.3" "1.18" "0.55" "1.14"'
> read.table(textConnection(dat), header=TRUE)
Genres     X1  X2   X3   X4   X5
1     V1 Action 0.3 1.18 0.55 1.14