I have a folder with file names as such:
- 1-EXPERIMENT-CONDITION1 Drug 1
- 2-EXPERIMENT-CONDITION2 Drug 2
- ...
- 10-EXPERIMENT-CONDITION4 Drug 3
- 11-EXPERIMENT-CONDITION5 Drug 3
- ...
- 21-EXPERIMENT-CONDITION1 Drug 2
I have produced a loop for automatic data analysis but the plot part gives me troubles. I cannot force the column names since the loop is built to accept multiple data names as inputs. Once I have produced a bar graph with ggplot2, column names are scrambles in a weird order:
- 1-EXPERIMENT-CONDITION1 Drug 1
- 10-EXPERIMENT-CONDITION4 Drug 3
- 11-EXPERIMENT-CONDITION5 Drug 3
- ...
- 2-EXPERIMENT-CONDITION2 Drug 2
- 21-EXPERIMENT-CONDITION1 Drug 2
- ...
I tried to order alphabetically or from small to large, but this did not change. I tried to transform values to numeric but this was even worse.
My question is: how can I rearrange column names in ggplot2 to have them alphabetically ordered?
Thanks :)