Transpose not working on Array{Any,2}

transpose is not working for a specific matrix I have. Consider the last line in the code below.

Is this deliberate? am I missing anything here?

I can work around this, by using permutedims, but I would have expected transpose to work.

transpose(othermat) #works

mat=Any["Correlation" 0.367298; "Std Dev Trn" 1.54907e-8; "Std Dev Val" 0.0115051;]

permutedims(mat,[2,1]) #works
permutedims(mat,(2,1)) #works

transpose(mat) #does not work on julia 0.6

ERROR: MethodError: no method matching transpose(::String)
Closest candidates are:
transpose(::BitArray{2}) at linalg\bitarray.jl:265
transpose(::Number) at number.jl:100
transpose(::RowVector{T,CV} where CV<:(ConjArray{T,1,V} where V<:(AbstractArray{T,1} where T) where T) where T) at linalg\rowvector.jl:82

[1] transpose_f!(::Base.#transpose, ::Array{Any,2}, ::Array{Any,2}) at .\linalg\transpose.jl:54
[2] transpose(::Array{Any,2}) at .\linalg\transpose.jl:121

This is intentional, but controversial. See for some discussion of whether or not it actually makes sense to get the error you’re seeing.

In the meantime, your permutedims() solution is perfectly good.

1 Like

thank you.