Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3598546
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:15:20+00:00 2026-05-18T20:15:20+00:00

I have a data set with 100 inputs, they are either called X or

  • 0

I have a data set with 100 inputs, they are either called X or Y. I am trying to use the anova function to compare these categorical X’s and Y’s to a quantitative variable (length). How do I convert my categorical variable to something quantitative? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:15:21+00:00Added an answer on May 18, 2026 at 8:15 pm

    You may not need to to do any conversion: the factor and character data types are accepted by lm and anova(). It;s possible that you are thinking of aov which is for balanced designs. lm is the regression function that will handle the unbalanced linear models.

    > set.seed(123)
    > typ <- sample(c("X", "Y"), 100, prob=c(1,2)/3, replace=TRUE)
    > num <- rnorm(100) + (typ=="Y")
    > dfrm <- data.frame(num =num, typ =typ)
    
    > fit<-lm(num~typ, data=dfrm)
    > anova(fit)
    Analysis of Variance Table
    
    Response: num
              Df Sum Sq Mean Sq F value    Pr(>F)    
    typ        1 21.422 21.4225  22.787 6.331e-06 ***
    Residuals 98 92.133  0.9401                      
    ---
    Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
    > fit
    
    Call:
    lm(formula = num ~ typ, data = dfrm)
    
    Coefficients:
    (Intercept)         typY  
       -0.04325      0.98433  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data set with 100 inputs, they are either called X or
I have a data set that looks like this: 000 100 200 300 010
I have the following data set that I am trying to plot with ggplot2,
I have a data set that is in the format 100 domain bacteria phylum
I have a data set whose elements are displayed as rows in a DataGrid.
I have a data set that is organized in the following manner: Timestamp|A0001|A0002|A0003|A0004|B0001|B0002|B0003|B0004 ...
I have a data set with over 50,000 geocoded points (lat-long). Each point has
I have a data set which consists of an ID and a matrix (n
I have a data set that is around 700 rows with eight columns of
Interpolating Large Datasets I have a large data set of about 0.5million records representing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.