Giter Site home page Giter Site logo

grp_in parameter question about ggord HOT 4 CLOSED

fawda123 avatar fawda123 commented on September 13, 2024
grp_in parameter question

from ggord.

Comments (4)

fawda123 avatar fawda123 commented on September 13, 2024

Hi, it works fine in this example. Can you provide a minimal working example that shows the problem? Or am I misunderstanding the problem?

library(ggord)
library(vegan)
library(dplyr)

iris2 <- iris %>% 
  mutate(
    Species = case_when(
      Species == 'setosa' ~ 'spp1', 
      Species != 'setosa' ~ 'spp2'
    )
  )

# prcomp
ord <- prcomp(iris2[, 1:4])

p <- ggord(ord, grp_in = iris2$Species)
p

image

from ggord.

skytguuu avatar skytguuu commented on September 13, 2024

Hi,

Thanks for your reply. Actually, u misunderstood my question. In your case, the group spp1 and spp2 have more than 2 observations (row is more than 4, in your case the row is 150). The problem is if the row is no more than 4, it will report the error. The data is as followed:

image

from ggord.

fawda123 avatar fawda123 commented on September 13, 2024

Ah, I see. Problem is it's trying to create confidence ellipses for groups with less than three observations. Set ellipse = F and you should be good to go.

from ggord.

fawda123 avatar fawda123 commented on September 13, 2024

And for what it's worth, I added an error message indicating the same if there's insufficient observations to create the ellipses.

library(ggord)
library(vegan)
library(dplyr)

iris2 <- iris %>% 
  mutate(
    Species = case_when(
      Species == 'setosa' ~ 'spp1', 
      Species != 'setosa' ~ 'spp2'
    )
  ) %>% 
  .[c(1:2, 51:52),]

# prcomp
ord <- prcomp(iris2[, 1:4])

ggord(ord, grp_in = iris2$Species)

## Error in ggord.default(obs, vecs, axes, ...) : 
## Insufficient observations for confidence ellipses, set ellipse = F to plot

from ggord.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.