Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmaCartuyvels1 committed Nov 26, 2024
1 parent 7a35609 commit 38a9bc3
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions source/power_analyse.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ flower_effect <- rnorm(1000, mean = 50, sd = 10) # Bloemen (voorbeeld)
```

```{r startpopulatie}
n_spec_per_loc <- pmax(0,
n_spec_per_loc <- as.integer(pmax(0,

Check warning on line 41 in source/power_analyse.Rmd

View workflow job for this annotation

GitHub Actions / check project with checklist

file=source/power_analyse.Rmd,line=41,col=37,[trailing_whitespace_linter] Trailing whitespace is superfluous.
rnorm(n_locations,
avg_species_per_loc,
sd_species_per_loc))
sd_species_per_loc)))
```


```{r}
simulate_species_presence <- function(n_species,
n_present,
Expand All @@ -60,7 +59,7 @@ simulate_species_presence <- function(n_species,

Check warning on line 59 in source/power_analyse.Rmd

View workflow job for this annotation

GitHub Actions / check project with checklist

file=source/power_analyse.Rmd,line=59,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
# Wijs aanwezigheid toe
species <- species %>%

Check warning on line 61 in source/power_analyse.Rmd

View workflow job for this annotation

GitHub Actions / check project with checklist

file=source/power_analyse.Rmd,line=61,col=22,[object_usage_linter] no visible global function definition for '%>%'

Check warning on line 61 in source/power_analyse.Rmd

View workflow job for this annotation

GitHub Actions / check project with checklist

file=source/power_analyse.Rmd,line=61,col=22,[object_usage_linter] no visible global function definition for '%>%'

Check warning on line 61 in source/power_analyse.Rmd

View workflow job for this annotation

GitHub Actions / check project with checklist

file=source/power_analyse.Rmd,line=61,col=22,[object_usage_linter] no visible global function definition for '%>%'
mutate(is_present = rbinom(n_species,
mutate(is_present = rbinom(1,

Check warning on line 62 in source/power_analyse.Rmd

View workflow job for this annotation

GitHub Actions / check project with checklist

file=source/power_analyse.Rmd,line=62,col=5,[object_usage_linter] no visible global function definition for 'mutate'
size = 1,
prob = presence_prob) # Aanwezigheidsstatus

Check warning on line 64 in source/power_analyse.Rmd

View workflow job for this annotation

GitHub Actions / check project with checklist

file=source/power_analyse.Rmd,line=64,col=39,[object_usage_linter] no visible binding for global variable 'presence_prob'
) %>%
Expand All @@ -71,6 +70,22 @@ simulate_species_presence <- function(n_species,
}
```

```{r}
# Simuleer soorten per locatie
location_species <- tibble(
location_id = 1:n_locations,
species_count = n_spec_per_loc
) %>%
rowwise() %>%
mutate(
present_species = list(simulate_species_presence(
n_species = n_species,
n_present = n_spec_per_loc,
general_prob = 0.8,
rare_prob = 0.2
))
)
```



Expand Down

0 comments on commit 38a9bc3

Please sign in to comment.