Stream: helpdesk (published)

Topic: How to transpose vector of strings?


view this post on Zulip Júlio Hoffimann (Jul 13 2021 at 12:22):

julia> v = ["foo", "bar"]
2-element Vector{String}:
 "foo"
 "bar"

julia> v'
1×2 adjoint(::Vector{String}) with eltype Union{}:
Error showing value of type LinearAlgebra.Adjoint{Union{}, Vector{String}}:
ERROR: MethodError: no method matching adjoint(::String)
Closest candidates are:
  adjoint(::SuiteSparse.CHOLMOD.FactorComponent{Tv, :L}) where Tv at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/SuiteSparse/src/cholmod.jl:1175
  adjoint(::SuiteSparse.CHOLMOD.FactorComponent{Tv, :U}) where Tv at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/SuiteSparse/src/cholmod.jl:1176
  adjoint(::SuiteSparse.CHOLMOD.FactorComponent{Tv, :PtL}) where Tv at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/SuiteSparse/src/cholmod.jl:1177
  ...
Stacktrace:

view this post on Zulip Kwaku Oskin (Jul 13 2021 at 12:29):

Type piracy? :-)

view this post on Zulip Kwaku Oskin (Jul 13 2021 at 12:31):

https://discourse.julialang.org/t/transpose-of-an-array-of-strings/40431

view this post on Zulip Kwaku Oskin (Jul 13 2021 at 12:31):

Depending on task, you can either use permutedims or add transpose for strings.


Last updated: Nov 22 2024 at 04:41 UTC