Remove the situation column from `summary` when all_situations=FALSE

Abierto
#6 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
r
Área
data

Línea de trabajo

Start by locating the summary implementation and checking how all_situations=FALSE shapes its output. Compare the current and proposed outputs, including the suggestion about removing group, and check existing tests for summary behavior. Done means the returned data frame omits the requested redundant columns without changing the remaining statistics.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

When using all_situations=FALSE (the default) in summary, we still get the "situation" column, which is just polluting the output data.frame because all values are set to "all_situations" anyway.

Example:

library(CroPlotR)
workspace <- system.file(
    file.path("extdata", "stics_example_1"),
    package = "CroPlotR"
)

sim <- SticsRFiles::get_sim(
    workspace = workspace,
    usms_file = file.path(workspace, "usms.xml")
)

obs <- SticsRFiles::get_obs(
    workspace = workspace,
    usm = situations,
    usms_file = file.path(workspace, "usms.xml")
)

summary(sim,obs = obs, stats = c("EF", "RMSE"))

Returns:

# A tibble: 2 × 5
  group     situation      variable    EF  RMSE
  <chr>     <chr>          <chr>    <dbl> <dbl>
1 Version_1 all_situations lai_n    0.636 0.631
2 Version_1 all_situations masec_n  0.871 0.945

I propose to remove the "situation" column in this case to get:

# A tibble: 2 × 5
  group    variable    EF  RMSE
  <chr>    <chr>    <dbl> <dbl>
1 Version_1 lai_n    0.636 0.631
2 Version_1 masec_n  0.871 0.945

And in this case we should we also remove the "group" variable.

What we could do is:

if (length(unique(df$variable)) == 1){
select(df, -variable)
}

if (length(unique(df$group)) == 1){
select(df, -group)
}
Lenguaje dominante
R
Estrellas
1
Forks
3
Merge medio
9 h 41 min
PR fusionados (30 d)
2

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de SticsRPacks/CroPlotR

Todos los issues de SticsRPacks/CroPlotR

Issues similares

Más issues de R

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.