Converting matrices in stplanr

Hi!

I am currently attempting to use the 'stplanr' package on R to analyse od matrice. I am trying to use the code 'odmatrix_to_od' to prepare my data in a table-style format but after I run the programme the following message is left:

Error in as.table.default(odmatrix) : cannot coerce to a table

I can't seem to get past this message. The data I'm using is 1299x1299, could it be that this data set is too large to process?

Thanks!

Hi, I have no experience with the packages but I glanced at the document now.
It seems your square od matrix is the issue. The function is supposed to transpose your data from long wise to width wise. But a square is equal sided. The documentation hints that a typical odmatrix might not have more than 3 necessary fields. But has parameters that perhaps could be used to make the function work, depending on your knowledge of your data.

This function takes a data frame representing travel between origins (with origin codes in name_orig , typically the 1st column) and destinations (with destination codes in name_dest , typically the second column) and returns a matrix with cell values (from attrib , the third column by default)

Hi! Thanks for the response

Yes currently my od matrix the origin in the first coloumn, destination in the first row and the value are count values found at each location.

Do you think if I use the process the data through the function in two sets this could help?

I'm afraid I don't understand your description of the matrix...
what does it mean for origin to be 1st col and destination first row.

I assumed that the od_matrix being longform would ideally be something like : ```

col1 col2 col3
orig 1 dest 1 1
orig 2 dest 2 2
orig 2 dest 3 3

Note: I used this handy markdown table generator to sketch the above table:
https://www.tablesgenerator.com/markdown_tables#

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.