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

  • SEARCH
  • Home
  • 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 6341095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:57:47+00:00 2026-05-24T19:57:47+00:00

How can I do some sort of mass recode of a dataset in R

  • 0

How can I do some sort of mass recode of a dataset in R using only the base, car, and foreign packages? I’m on a government computer, so I can’t install any additional packages to make this easier. Ideally, I’d like to be able to supply a dataframe to car’s recode function or apply the recode function over all/most variables in the dataframe. I’m trying to figure ut how to do this an apply/lapply function, but I don’t know how to use them and haven’t had much success. the idea looks like the following, though this code doesn’t work:

for vectors 2 through 92 in data frame “df”:

df<-recode(df[2:92], '98:100=NA)

Any suggestions? I’d greatly appreciate it.

  • 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-24T19:57:48+00:00Added an answer on May 24, 2026 at 7:57 pm

    Perhaps:

    is.na( df[, 2:92] ) <- df[ ,2:92] >= 98 & df[, 2:92] <= 100
    

    is.na() can accept assignment in which case it is the is.na<- function and needs a logical vector, matrix, or array of the same extent as the target. I tried the %in% function but it was not properly vectorized (or perhaps matricized?) to do the job. I thought maybe just using column numbers as Joe tried would work but also got no success down that path.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm now wondering whether we can make some sort of SSL server based on
To access the array indice at the xth position we can use some sort
I am looking at some sort of existing filter which can sanitize the user
Does Windows provide some sort of evented API so I can run some code
I am building a gaming system where many players can play some sort of
Can I use some sort of line break in the alt text for an
Is there some sort of onTerminate() method where I can do some cleanup (I
Is it possible to have some sort of debug/release configurations that I can chose
Is there a way that I can handle some sort of catch-all error handling
Can some one please explain why this loop never 'breaks' and goes on forever

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.