Index of data is missing (dim is NULL)
Please use this list for finance-related questions. Just because you're using R to solve a finance-related problem does not mean your question is finance-related. In this case, your "problem" is that rel_data is a *vector*. Please read, "An Introduction to R" to understand the differences between vectors and matrices / data.frames (and note that subsetting a matrix via "[" with drop=TRUE can result in a vector).
x <- 1:10 # This is a vector dim(x)
NULL
x[1,]
Error in x[1, ] : incorrect number of dimensions
matrix(1:10,2) # This is a matrix
[,1] [,2] [,3] [,4] [,5] [1,] 1 3 5 7 9 [2,] 2 4 6 8 10
matrix(1:10,2)[1,] # This is a vector
[1] 1 3 5 7 9
matrix(1:10,2)[1,,drop=FALSE] # This is a matrix
[,1] [,2] [,3] [,4] [,5] [1,] 1 3 5 7 9 HTH, Josh -- http://www.fosstrading.com
On Wed, Sep 2, 2009 at 6:26 AM, sunil<sarswat at gmail.com> wrote:
Hi Users, ? ? ? ? ? ? I am working on F&O order-book data, and I noticed index of subset of data is missing? Usually when you type the variable name it shows you row numbers like [1,], [2,] etc., but here row number is missing. When I ask for dim(data) command , it shows "NULL" ? Please see below
rel_data
? ? ? symbols insuments_type ? ?expire date ? ? ? quantity ? ? ? ? ?price ?time_stamp ? ? ? ? ? ? BS ? ? order_type ?"JPASSOCIAT" ? ? ? "FUTSTK" ? ? "20080424" ? ? ? ? ?"750" ? ? ? "240.90" ?"13:55:30" ? ? ? ? ? ?"S" ? ? ? ? ? "RL"
dim(rel_data)
NULL
rel_data[1,]
Error in rel_data[1, ] : incorrect number of dimensions