I am working on data analysis and trying to write the simplest code for now.
setwd("/Users/Gizmo/Desktop/Harry")
harry_data <- dir()
HarryData <- array(0,dim=c(4464,8,15))
h13 <- read.table(harry_data[1],skip=2,header=FALSE)
HarryData[,,1] <- matrix(h13,4464,8)
I checked dimensions for HarryData, h13, and matrix and they are all in same dimension. But if I put data, h13 in HarryData, it doesn't work.
I get this error Error in HarryData[, , 1]
: incorrect number of dimensions if HarryData[,,1]
on Console
Part of My data in h13 is like this obtained from ftp://amrc.ssec.wisc.edu/pub/aws/10min/rdr/2013/089000113.r:
V1 V2 V3 V4 V5 V6 V7 V8
1 1 1 -7.8 879.0 5.6 360 444.0 9.1
2 1 2 -7.9 879.1 4.6 360 444.0 9.1
3 1 3 -7.6 879.2 4.1 345 444.0 9.1
4 1 4 -7.6 879.3 4.1 339 444.0 9.1
5 1 5 -7.6 879.4 4.8 340 444.0 9.1
6 1 6 -7.9 879.4 3.6 340 444.0 9.1
7 1 7 -8.0 879.3 4.6 340 444.0 9.1
8 1 8 -8.0 879.4 4.1 340 444.0 9.1
9 1 9 -8.2 879.4 5.8 338 444.0 9.1
10 1 10 -8.4 879.5 4.6 339 444.0 9.1
11 1 11 -8.4 879.5 3.8 350 444.0 9.1
12 1 12 -8.1 879.5 4.1 347 444.0 9.1
13 1 13 -8.4 879.6 4.1 347 444.0 9.1
14 1 14 -8.0 879.6 5.1 357 444.0 9.1
15 1 15 -8.4 879.5 4.8 342 444.0 9.1
16 1 16 -8.5 879.7 4.1 359 444.0 9.1
17 1 17 -8.8 879.6 4.3 338 444.0 9.1
18 1 18 -8.4 879.7 3.6 350 444.0 9.1
19 1 19 -8.2 879.8 5.3 346 444.0 9.1
20 1 20 -7.9 879.8 1.3 360 444.0 9.1
What can be the problem causing this?
you should use as.matrix instead of matrix:
HarryData[,,1] <- as.matrix(h13)