我尝试使用以下代码阅读 R 中的简单 csv 文件:
data <- read.csv(file="\0Laplacian1Entropy.csv", header=TRUE, sep=" ")
但我总是得到这个错误:
> Error: embedded nul in string: '\0Laplacian1Entropy.csv'
这是我的档案:
i j Entropy
1 63 0.99908075437993904
1 64 0.99908075437993904
2 63 0.90122030232323391
2 64 0.92235382341992733
3 63 0.56791528442061989
3 64 0.67774259405167925
4 63 0.99908075437993904
4 64 0.96221996088169448
5 63 0.7960934421903898
5 64 0.71618862493713764
6 63 0.97911703542740458
6 64 0.46549718791094752
7 63 0.90122030232323391
7 64 0.73578113660861544
8 63 0.77573042572641582
8 64 0.77573042572641582
9 63 0.8586686413596436
9 64 0.90122030232323391
10 63 0.83758110743543879
10 64 0.67774259405167925
11 63 0.99908075437993904
11 64 0.8586686413596436
12 63 0.96221996088169448
12 64 0.67774259405167925
13 63 0.99908075437993904
13 64 0.8586686413596436
14 63 0.62183659568813598
14 64 0.56791528442061989
15 63 0.65887781135396584
15 64 0.8586686413596436
16 63 0.92235382341992733
16 64 0.92235382341992733
17 63 0.7960934421903898
17 64 0.92235382341992733
18 63 0.60364928357716474
18 64 0.90122030232323391
19 63 0.90122030232323391
19 64 0.83758110743543879
20 63 0.92235382341992733
20 64 0.71618862493713764
21 63 0.73578113660861544
21 64 0.96221996088169448
22 63 0.77573042572641582
22 64 0.96221996088169448
23 63 0.90122030232323391
23 64 0.97911703542740458
24 63 0.71618862493713764
24 64 0.8586686413596436
25 63 0.96221996088169448
25 64 0.99908075437993904
26 63 0.97911703542740458
26 64 0.7960934421903898
27 63 0.67774259405167925
27 64 0.71618862493713764
28 63 0.65887781135396584
28 64 0.67774259405167925
29 63 0.83758110743543879
29 64 0.90122030232323391
30 63 0.90122030232323391
30 64 0.77573042572641582
31 63 0.97911703542740458
31 64 0.73578113660861544
32 63 0.97911703542740458
32 64 0.99908075437993904
33 63 0.99908075437993904
33 64 0.8586686413596436
34 63 0.96221996088169448
34 64 0.92235382341992733
35 63 0.65887781135396584
35 64 0.96221996088169448
36 63 0.62183659568813598
36 64 0.62183659568813598
37 63 0.60364928357716474
37 64 0.97911703542740458
38 63 0.99908075437993904
38 64 0.90122030232323391
39 63 0.90122030232323391
39 64 0.97911703542740458
40 63 0.7960934421903898
40 64 0.73578113660861544
41 63 0.71618862493713764
41 64 0.96221996088169448
42 63 0.51584300284627072
42 64 0.67774259405167925
43 63 0.51584300284627072
43 64 0.97911703542740458
44 63 0.99908075437993904
44 64 0.96221996088169448
45 63 0.97911703542740458
45 64 0.96221996088169448
46 63 0.60364928357716474
46 64 0.67774259405167925
47 63 0.40086503572425503
47 64 0.62183659568813598
48 63 0.83758110743543879
48 64 0.56791528442061989
49 63 0.56791528442061989
49 64 0.8586686413596436
50 63 0.56791528442061989
50 64 0.96221996088169448
51 63 0.99908075437993904
51 64 0.8586686413596436
52 63 0.67774259405167925
52 64 0.83758110743543879
53 63 0.83758110743543879
53 64 0.77573042572641582
54 63 0.92235382341992733
54 64 0.92235382341992733
55 63 0.83758110743543879
55 64 0.83758110743543879
56 63 0.92235382341992733
56 64 0.92235382341992733
57 63 0.99908075437993904
57 64 0.73578113660861544
58 63 0.62183659568813598
58 64 0.99908075437993904
59 63 0.67774259405167925
59 64 0.96221996088169448
60 63 0.99908075437993904
60 64 0.97911703542740458
61 63 0.60364928357716474
61 64 0.97911703542740458
62 63 0.96221996088169448
62 64 0.46549718791094752
63 1 0.92235382341992733
63 2 0.97911703542740458
63 3 0.97911703542740458
63 4 0.7960934421903898
63 5 0.8586686413596436
63 6 0.7960934421903898
63 7 0.77573042572641582
63 8 0.26477764946943599
63 9 0.97911703542740458
63 10 0.71618862493713764
63 11 0.62183659568813598
63 12 0.77573042572641582
63 13 0.51584300284627072
63 14 0.62183659568813598
63 15 0.96221996088169448
63 16 0.99908075437993904
63 17 0.7960934421903898
63 18 0.96221996088169448
63 19 0.65887781135396584
63 20 0.62183659568813598
63 21 0.92235382341992733
63 22 0.96221996088169448
63 23 0.83758110743543879
63 24 0.56791528442061989
63 25 0.92235382341992733
63 26 0.71618862493713764
63 27 0.65887781135396584
63 28 0.99908075437993904
63 29 0.8586686413596436
63 30 0.7960934421903898
63 31 0.67774259405167925
63 32 0.67774259405167925
63 33 0.97911703542740458
63 34 0.83758110743543879
63 35 0.99908075437993904
63 36 0.71618862493713764
63 37 0.97911703542740458
63 38 0.97911703542740458
63 39 0.44907944580528197
63 40 0.65887781135396584
63 41 0.96221996088169448
63 42 0.77573042572641582
63 43 0.77573042572641582
63 44 0.67774259405167925
63 45 0.73578113660861544
63 46 0.71618862493713764
63 47 0.90122030232323391
63 48 0.97911703542740458
63 49 0.90122030232323391
63 50 0.62183659568813598
63 51 0.97911703542740458
63 52 0.8586686413596436
63 53 0.90122030232323391
63 54 0.67774259405167925
63 55 0.97911703542740458
63 56 0.55035872021707255
63 57 0.90122030232323391
63 58 0.77573042572641582
63 59 0.7960934421903898
63 60 0.8586686413596436
63 61 0.55035872021707255
63 62 0.92235382341992733
63 63 0.56791528442061989
63 64 0.71618862493713764
63 65 0.99908075437993904
63 66 0.65887781135396584
63 67 0.96221996088169448
63 68 0.96221996088169448
63 69 0.96221996088169448
63 70 0.8586686413596436
63 71 0.96221996088169448
63 72 0.96221996088169448
63 73 0.8586686413596436
63 74 0.62183659568813598
63 75 0.83758110743543879
63 76 0.77573042572641582
63 77 0.60364928357716474
63 78 0.97911703542740458
63 79 0.7960934421903898
63 80 0.83758110743543879
63 81 0.77573042572641582
63 82 0.90122030232323391
63 83 0.8586686413596436
63 84 0.83758110743543879
63 85 0.73578113660861544
63 86 0.96221996088169448
63 87 0.67774259405167925
63 88 0.99908075437993904
63 89 0.90122030232323391
63 90 0.96221996088169448
63 91 0.56791528442061989
63 92 0.97911703542740458
63 93 0.92235382341992733
63 94 0.83758110743543879
63 95 0.99908075437993904
63 96 0.83758110743543879
63 97 0.7960934421903898
63 98 0.62183659568813598
63 99 0.99908075437993904
63 100 0.97911703542740458
63 101 0.62183659568813598
63 102 0.65887781135396584
63 103 0.56791528442061989
63 104 0.73578113660861544
63 105 0.83758110743543879
63 106 0.60364928357716474
63 107 0.67774259405167925
63 108 0.8586686413596436
63 109 0.56791528442061989
63 110 0.96221996088169448
63 111 0.92235382341992733
63 112 0.7960934421903898
63 113 0.92235382341992733
63 114 0.99908075437993904
63 115 0.83758110743543879
63 116 0.92235382341992733
63 117 0.73578113660861544
63 118 0.67774259405167925
63 119 0.99908075437993904
63 120 0.83758110743543879
63 121 0.97911703542740458
63 122 0.7960934421903898
63 123 0.7960934421903898
63 124 0.62183659568813598
63 125 0.62183659568813598
63 126 0.8586686413596436
64 1 0.90122030232323391
64 2 0.90122030232323391
64 3 0.96221996088169448
64 4 0.51584300284627072
64 5 0.8586686413596436
64 6 0.67774259405167925
64 7 0.97911703542740458
64 8 0.92235382341992733
64 9 0.7960934421903898
64 10 0.73578113660861544
64 11 0.96221996088169448
64 12 0.96221996088169448
64 13 0.99908075437993904
64 14 0.56791528442061989
64 15 0.77573042572641582
64 16 0.90122030232323391
64 17 0.7960934421903898
64 18 0.90122030232323391
64 19 0.7960934421903898
64 20 0.90122030232323391
64 21 0.7960934421903898
64 22 0.77573042572641582
64 23 0.97911703542740458
64 24 0.71618862493713764
64 25 0.96221996088169448
64 26 0.83758110743543879
64 27 0.92235382341992733
64 28 0.77573042572641582
64 29 0.73578113660861544
64 30 0.62183659568813598
64 31 0.83758110743543879
64 32 0.97911703542740458
64 33 0.73578113660861544
64 34 0.7960934421903898
64 35 0.90122030232323391
64 36 0.96221996088169448
64 37 0.73578113660861544
64 38 0.51584300284627072
64 39 0.49887493461148946
64 40 0.71618862493713764
64 41 0.71618862493713764
64 42 0.83758110743543879
64 43 0.99908075437993904
64 44 0.62183659568813598
64 45 0.96221996088169448
64 46 0.65887781135396584
64 47 0.71618862493713764
64 48 0.8586686413596436
64 49 0.8586686413596436
64 50 0.65887781135396584
64 51 0.60364928357716474
64 52 0.7960934421903898
64 53 0.8586686413596436
64 54 0.96221996088169448
64 55 0.8586686413596436
64 56 0.8586686413596436
64 57 0.73578113660861544
64 58 0.49887493461148946
64 59 0.96221996088169448
64 60 0.92235382341992733
64 61 0.96221996088169448
64 62 0.8586686413596436
64 63 0.36955204268044284
64 64 0.44907944580528197
我想知道这是什么问题。
答案 0 :(得分:4)
这与您的csv文件无关。错误消息指出您在文件名中嵌入了一个nul char:\0
表示ASCII byte == 0,在R字符串中被禁止(在内部,它表示字符串的结尾)。
也许您的意思是"\\0Laplacian1Entropy.csv"
或"/0Laplacian1Entropy.csv"
。无论如何,如果你想在字符串中包含反斜杠,你必须用...反斜杠来逃避它。
答案 1 :(得分:1)
删除de&#34; \ 0&#34;让你的命令像这样:
data&lt; - read.csv(file =&#34; Laplacian1Entropy.csv&#34;,header = TRUE,sep =&#34;&#34;)
头(数据)