我正在尝试上传csv文件,我很困惑为什么我会得到不同的呈现格式
例如
test1 = read.csv("test1.csv")
Date Open High Low Close Volume Adj.Close
1 2014-04-25 1877.72 1877.72 1859.70 1863.40 3213020000 1863.40
2 2014-04-24 1881.97 1884.06 1870.24 1878.61 3191830000 1878.61
3 2014-04-23 1879.32 1879.75 1873.91 1875.39 3085720000 1875.39
4 2014-04-22 1872.57 1884.89 1872.57 1879.55 3215440000 1879.55
5 2014-04-21 1865.79 1871.89 1863.18 1871.89 2642500000 1871.89
6 2014-04-17 1861.73 1869.63 1856.72 1864.85 3341430000 1864.85
如果我这样做
test <- list.files(pattern = "*.csv")
read.all <- sapply(test, read.csv)
head(read.all["test1.csv"])
$test1.csv
Date Open High Low Close Volume Adj.Close
1 2014-04-25 14554.3 14554.3 14472.1 14533.6 149223000 14533.60
2 2014-04-24 14533.4 14584.1 14522.2 14554.3 181767100 14554.30
3 2014-04-23 14556.3 14587.1 14533.4 14533.4 166976100 14533.40
4 2014-04-22 14492.9 14556.6 14471.9 14556.0 159636400 14556.00
5 2014-04-21 14500.4 14509.7 14232.3 14493.7 135970800 14493.70
6 2014-04-17 14446.5 14508.5 14423.7 14500.4 169281200 14500.40
7 2014-04-16 14303.9 14448.6 14303.9 14446.5 196046500 14446.50
8 2014-04-15 14284.4 14355.5 14224.9 14303.9 176427100 14303.90
9 2014-04-14 14257.7 14357.0 14245.5 14284.4 161845500 14284.40
10 2014-04-11 14308.0 14308.0 14221.4 14257.7 159710900 14257.70
11 2014-04-10 14435.6 14444.9 14266.6 14308.0 209549500 14308.00
12 2014-04-09 14372.4 14444.6 14372.4 14435.6 182481700 14435.60
13 2014-04-08 14270.3 14382.8 14251.9 14372.5 161334500 14372.50
14 2014-04-07 14393.1 14393.1 14247.1 14270.3 151538100 14270.
It just keep going
也
> nrow(test1)
1684
> nrow(read.all["test1.csv"])
NULL
为什么head()和nrow不工作?
由于