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 8107521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:48:08+00:00 2026-06-06T00:48:08+00:00

The data is saved in a .txt . There are 200 words saved in

  • 0

The data is saved in a .txt. There are 200 words saved in the same text. How can I input these raw material into R and do binary logistics regression for each of these words?

num 0 0.010752688172
num 0 0.003300330033

thanksgiving 0 0.0123456790123
thanksgiving 0 0.0016339869281
thanksgiving 0 0.00338983050847

off 0 0.00431034482759
off 0 0.00302114803625
off 1 0.001100110011
off 0 0.00377358490566
off 1 0.00166112956811
off 1 0.00281690140845
off 0 0.00564971751412
off 0 0.00112994350282
off 0 0.003300330033
off 0 0.0042735042735
off 1 0.00326797385621
off 0 0.00159489633174
off 0 0.00378787878788
  • 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-06-06T00:48:11+00:00Added an answer on June 6, 2026 at 12:48 am

    Here’s how I’d do it with the plyr package:

    # Load the plyr library
    library(plyr)
    
    # Read in the data
    allwords <- read.table("words.txt")
    
    # Name the variables more meaningfully than this
    names(allwords) <- c("word", "y", "x")
    
    # dlply iterates over the data.frame, splitting by "word", 
    # and running a glm with the arguments formula = y ~ x and family = binomial
    # and returns a list of the resulting glm objects
    models <- dlply(allwords,
                    .var = "word",
                    .fun = glm, formula = y ~ x, family = binomial)
    
    # It's then easy to iterate over that list using lapply, llply, ldply, etc.
    # (depending on what you want back out)
    # Summarize:
    llply(models, summary)
    
    # Get all the coefficients
    ldply(models, coef)
    
    # Get AICs
    # Not that you can compare these among word-models, but you get the idea.
    ldply(models, AIC)
    
    # Or, if you want to work with a particular model
    models$num
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a JSON data example saved in a file data.txt [ {name:yekky}, {name:mussie},
I have like 300000 words in my dictionary (actually saved in txt format (new
The script is in myusername/public_html/item/index.php code to save file: $filename = $_SERVER['DOCUMENT_ROOT'].'/../data/guestbook.txt'; $filehandle =
I need help with a problem regarding data saved in a parent-children model table
I have following query and data saved in a MySQL database with a timestamp
I have saved data which was saved using NSUserDefaults. I was under the impression
I have no control over how the data is saved in this table. However,
I saved some data in the database using mysql_real_escape_string() so the single quotes are
I know that data members are saved to disk but I was wondering whether
By default in windows application setting are saved in this directory: %USERPROFILE%\Local Settings\Application Data\<Company

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.