Graphing Issue - Making Y-axis represent the values of X-axis labels

Hello,

I am very new to R. I have a data-set including two groups that have data values for each hour of a test. I labeled every hour in the excel sheet, "hour 1", "hour 2", "hour 3", etc with corresponding values beneath them for each animal. I also labeled "group" with the corresponding group name beneath it. All represented in columns.

I am wanting to graph all the hours in the x-axis, with the y-axis representing those values for each hour. Then, I wish to separate those by groups. Is there any way to accomplish this? I have been able to look at each hour separately, but have not been able to combine all hours.

I appreciate any advice! Thank you so much!

Hi and welcome! I'm afraid you'll need to supply some more info in order for helpers to be able to understand your problem (this is pretty common — when you're new to this stuff, it's hard to know how much information is enough!).

The best thing would be if you can make your question into a reproducible example (follow the link for instructions and explanations). To include your data, you'll want to follow one of the methods discussed here.

If you try all that and get stuck, here's a fallback option...
  1. Edit your post and add in some of the code you have tried. It's OK it doesn't work! It's really helpful to see what you've been attempting. Be sure to format your code as code (it's hard to read unformatted code, and it can get garbled by the forum software)
  2. Include sample data:
    • If your data set is OK to share, run the following line and paste the output into your post. Again, be sure to format it as code :sparkles:
    dput(head(your_dataframe_name, 10))
    
    • If your data set can't be shared, run this line instead and paste the output into your post (and yes, format as code!) This will still share some information about your data. If it's truly confidential, I'm afraid you'll need to make a fake sample dataset to share.
    str(your_dataframe_name)
    

Thank you so much for the reply! I will try my best to improve my format of questioning. More specifically, if I have data for each hour for each animal within their own group, is it possible to plot multiple variables for x if their data is all represented in minutes and have the y-axis represent their values? This would make the x-axis "Hour 1, Hour 2, Hour, 3, etc." and then have y-axis reflect the minutes. Lastly, I am trying to have two groups for each timepoint.

attach(my_data)
The following objects are masked from my_data (pos = 3):

Drug, Hour.1, Hour.10,
Hour.11, Hour.12, Hour.13, Hour.14,
Hour.15, Hour.16, Hour.17, Hour.18,
Hour.19, Hour.2, Hour.20, Hour.21,
Hour.22, Hour.23, Hour.24, Hour.25,
Hour.26, Hour.27, Hour.28, Hour.29,
Hour.3, Hour.30, Hour.31, Hour.32,
Hour.33, Hour.34, Hour.35, Hour.36,
Hour.37, Hour.38, Hour.39, Hour.4,
Hour.40, Hour.41, Hour.42, Hour.43,
Hour.44, Hour.45, Hour.46, Hour.47,
Hour.48, Hour.5, Hour.6, Hour.7,
Hour.8, Hour.9

boxplot(Hour.1, Hour.2, Hour.3 ~ Drug)
Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) :
'x' must be atomic
In addition: Warning messages:
1: In is.na(x) :
is.na() applied to non-(list or vector) of type 'language'
2: In is.na(x) :
is.na() applied to non-(list or vector) of type 'language'

I found an answer for my question, so mine is solved! Viewing other question formats, I have a better idea of what is needed next time. Thank you, again.

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