# Transpose of an array of Strings

**URL:** https://discourse.julialang.org/t/transpose-of-an-array-of-strings/40431
**Category:** New to Julia
**Tags:** strings, arrays
**Created:** [May 29, 2020, 5:26pm UTC](https://discourse.julialang.org/t/transpose-of-an-array-of-strings/40431 "2020-05-29T17:26:45Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)
#### Post date: [May 29, 2020, 5:53pm UTC](https://discourse.julialang.org/t/transpose-of-an-array-of-strings/40431/3 "2020-05-29T17:53:53Z")

</div>

I have found that one can use the function ‘permutedims’ to accomplish the task. I do not know why one could not simply overload the transpose function (or the apostrophy operator) via dispatch? I assume that `transpose` is a more efficient version of `permutedims` that is optimized for `Numbers`.

In the end, here is some code I wrote related to the question asked. All is solved, although there is probably a more elegant way to accomplish this. I appreciate all the help.

```julia
prob_ode = ODEProblem(households!,u0,tspan,params);
sol_ode = solve(prob_ode, Tsit5());
df_ode = DataFrame(sol_ode(t)')
df_ode[!,:t] = t;

# Extract subsets of DataFrame
nb_save = 7
df_S = df_ode[!, 0*nb_houses+1 : 0*nb_houses+nb_save];
df_I = df_ode[!, 1*nb_houses+1 : 1*nb_houses+nb_save];
df_R = df_ode[!, 2*nb_houses+1 : 2*nb_houses+nb_save];
df_S[!,:t] = df_ode[!,:t];
df_I[!,:t] = df_ode[!,:t];
df_R[!,:t] = df_ode[!,:t];

nb_kept = 4;

# Put each state in its own database
function plotDF(dfr, state)
	labels=[];
	for i in 1:nb_kept push!(labels, "S"*repr(i) ) end
	@df dfr plot(:t,
    	cols([1:nb_kept]),
		label=permutedims(labels),
    	xlabel="Time",
    	ylabel="Number Susceptibles")
end

plotDF(df_S, "S")
plotDF(df_I, "I")
plotDF(df_R, "R")
```

---

_[View the full topic](https://discourse.julialang.org/t/transpose-of-an-array-of-strings/40431)._
