Statistical Analysis Code

Hye everyone,

I have a massive dataset which contains 4 different locations, and within each location consist of 4 other sublocation. So, I would like to compare those dataset. Anyone have any suggestion??

Thank you.

Best wishes,
MHA

Please post some of the data so we can make specific suggestions. If your data frame is called DF, run

dput(head(DF))

and post the output here. Be sure to place a line with only three back ticks just before and after the output.
```
your output here
```

Location Sublocation Flux
SA PB 3
SA HP 5
SA FP 8
SA IR 19
SB PB 7
SB HP 4
SB FP 11
SB IR 14
SC PB 8
SC HP 5
SC FP 2
SC IR 3
SD PB 9
SD HP 10
SD FP 6
SD IR 9

Here is an example of how to summarize the Flux values for each Location. What would you like to do, specifically?

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
DF <- read.csv("~/R/Play/Dummy.csv")
DF_Stats <- DF %>% group_by(Location) %>% 
  summarize(Avg = mean(Flux), Sigma = sd(Flux))
#> `summarise()` ungrouping output (override with `.groups` argument)
DF_Stats
#> # A tibble: 4 x 3
#>   Location   Avg Sigma
#>   <chr>    <dbl> <dbl>
#> 1 SA        8.75  7.14
#> 2 SB        9     4.40
#> 3 SC        4.5   2.65
#> 4 SD        8.5   1.73

Created on 2021-02-07 by the reprex package (v0.3.0)

Thank you for the code.
Specifically, I would like to compare by statistically by graph between the location and sublocation.

Here are some ideas for graphing using the ggplot2 library. I you have just one measurement for each combination of Location and Sublocation

library(ggplot2)
ggplot(DF, aes(x = Location, y = Flux, fill = Sublocation)) + 
  geom_col(position = "dodge")

If you have several reading at each combination

ggplot(DF, aes(x = Location, y = Flux, fill = Sublocation)) + 
  geom_boxplot()

Hi FJCC,

That was brilliant.It was exactly what I am looking for. It nicely showed the boxplot together with the graph..
Now, how I want to add statistical difference grouping to compare those boxplot?

Take a look at the ggsignif package. Give it a try and ask questions if you get stuck.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.