NEON-biodiversity / Ostats

O-statistics (community pairwise niche overlap statistics)
https://neon-biodiversity.github.io/Ostats/
Other
7 stars 2 forks source link

Argument name consistency for Ostats_plot #13

Closed sydnerecord closed 4 years ago

sydnerecord commented 4 years ago

HI @isafluck I've just finished going through all the documentation for the package. Thanks for all the great work by you and Arya! One quick suggestion that might seem a bit nit picky, but I think will be helpful to the users of our package. Can you change the arguments names in Ostats_plot to correspond with the naming conventions used for these three arguments in the rest of the package? Change trait to traits Change taxonID to sp Change siteID to plots

Thanks! Sydne

isafluck commented 4 years ago

Hello Sydne! It's done! I tested and it worked. I tried to push the changes but I don't know why the changes and my commit do not appear here. I believe that's because someone is working on something in this right moment... Some weird things are happening in my github desktop... I will wait a little and try again.

Best, Isa

isafluck commented 4 years ago

Hello Sydne! I have pushed the changes present in my github desktop, can you please check if everything is ok? I was not able to update the documentation of the ostats_plot. I believe it was because of some "<<<<head" characters, see the message when I tried to document the updated ostats_plot: 30: << ^ Calls: suppressPackageStartupMessages ... withr_with_dir -> force -> source_many -> source_one -> parse Execu��o interrompida

Exited with status 1.

Thank you, Isa

qdread commented 4 years ago

That's a merge conflict. It occurs when two people work on a file at the same time, and git does not know which version to use. The <<<head is one of the markers that shows you where the conflicted area is so you can fix it. The entire conflicted area would look like this:

<<<<<<< HEAD
( your version of the conflicted lines )
=======
( your collaborator's version of the conflicted lines )
>>>>>>> 17a88283234fe8cda436b

You need to go into the file, fix the conflict manually, then delete the <<< , ===, and >>> lines.

isafluck commented 4 years ago

Thank you very much, quentin! I fixed the conflicts!

Unfortunately, I have found a problem: the means are not plotted when the user chooses to plot all sites. I noticed that this happens not only with all sites but when I set a different set of sites2use (as you can see in the pictures). n_sites2use_problem n_sites2use_problem_all I believe the problem is at the final of that part of the function, where I used the function "gsub" to make a column of means according to the species.

 # If the user wants to plot the traits means.
  if(means==TRUE){
    #values per species
    taxon_mean<-aggregate(table_traits_taxon[,1], list(table_traits_taxon[,2]), mean, na.rm = TRUE)

    #make a column with repeted means for each specie
    table_all<-cbind(table_traits_taxon, table_traits_taxon[,2])
    for(i in 1:length(unique(sp))){
      name<-unique(table_all[,4])[i]
      T_F<-taxon_mean[,1]==name
      mean_name<-taxon_mean[,2][T_F]
      table_all[,4]<-gsub(name, mean_name, table_all[,4])
    }
    names(table_all)[names(table_all) == "table_traits_taxon[, 2]"] <- "means"

  }

I believe that because the warning is related to this function: Warning messages: 1: In gsub (name, mean_name, table_all [, 4]): argument 'replacement' has length> 1 and only the first element will be used

I tried other ways of replacement (like simple table_all[,4][table_all[,4]==name]<- mean_name and other varieties) and even other functions but it did not work. Sorry, it is so frustrating...it seems to be simple but nothing is working here... does someone has an idea to resolve it?

Thank you

isafluck commented 4 years ago

Hello! I solved the problem... now the plot means works for all species too. problem_solved_all

sydnerecord commented 4 years ago

Awesome, Isadora! Thank you for your work on this.

Best, Sydne

On Tue, Sep 15, 2020 at 10:41 AM isafluck notifications@github.com wrote:

Hello! I solved the problem... now the plot means works for all species too. [image: problem_solved_all] https://user-images.githubusercontent.com/65627563/93224334-5d672180-f747-11ea-93c7-503031e1d533.JPG

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/NEON-biodiversity/Ostats/issues/13#issuecomment-692761149, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACK6RVHZMBUA36INPAULTFLSF54LJANCNFSM4RL2DAOA .

-- Sydne Record, Ph.D.

Associate Professor Department of Biology Bryn Mawr College Park 209 Bryn Mawr, PA 19010 phone: (610) 526-5094 fax: (610) 526-5086 she.her.hers

qdread commented 4 years ago

Good work! 🏅 🥂 🥳

isafluck commented 4 years ago

Sometimes all we need is a good night of sleep... The code is not beautiful, I think, but at least it works.. hehe Please let me know if any errors arise.