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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:05:00+00:00 2026-06-13T02:05:00+00:00

I have a data frame that I’ve discretized using RWeka . RWeka’s discretization creates

  • 0

I have a data frame that I’ve discretized using RWeka. RWeka’s discretization creates bins with single quotes in them. Although they are not causing any problems, while plotting it looks ugly to have a variable with 'All' category.

Here’s the discretized data frame:

structure(list(outlook = structure(c(1L, 1L, 2L, 3L, 3L, 3L, 
2L, 1L, 1L, 3L, 1L, 2L, 2L, 3L), .Label = c("sunny", "overcast", 
"rainy"), class = "factor"), temperature = structure(c(1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "'All'", class = "factor"), 
humidity = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L), .Label = "'All'", class = "factor"), 
windy = c(FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, 
FALSE, FALSE, TRUE, TRUE, FALSE, TRUE), play = structure(c(2L, 
2L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L), .Label = c("yes", 
"no"), class = "factor")), .Names = c("outlook", "temperature", 
"humidity", "windy", "play"), row.names = c(NA, -14L), class = "data.frame")

How can I remove the single quotes from the data and recreate the factors?

  • 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-13T02:05:01+00:00Added an answer on June 13, 2026 at 2:05 am

    This should do it:

    df$temperature <- gsub("\\'", "", df$temperature)
    df$humidity <- gsub("\\'", "", df$humidity)
    > df
        outlook temperature humidity windy play
    1     sunny         All      All FALSE   no
    2     sunny         All      All  TRUE   no
    3  overcast         All      All FALSE  yes
    4     rainy         All      All FALSE  yes
    5     rainy         All      All FALSE  yes
    6     rainy         All      All  TRUE   no
    7  overcast         All      All  TRUE  yes
    8     sunny         All      All FALSE   no
    9     sunny         All      All FALSE  yes
    10    rainy         All      All FALSE  yes
    11    sunny         All      All  TRUE  yes
    12 overcast         All      All  TRUE  yes
    13 overcast         All      All FALSE  yes
    14    rainy         All      All  TRUE   no
    

    If you need to do the same over several columns, this might be more efficient.

    df[, 2:3] <- apply(df[, 2:3], 2, function(x) { 
        gsub("\\'", "", x)
        })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data frame that I pass to another program using system() .
I'm using R and I have a data.frame with nearly 2,000 entries that looks
I have a data frame that is some 35,000 rows, by 7 columns. it
I have a data frame that's about ts1[100, 2000] in dimension as follows: >
I have a data.frame that looks like this: > head(ff.df) .id pio caremgmt prev
I have a data.frame in R that looks like this: score rms template aln_id
I have a data frame in R that has come about from running some
I have a data frame in R that looks like this: > TimeOffset, Source,
I have a data.frame and I'm trying to create a frequency table that shows
Let's assume that we have a data frame x which contains the columns job

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.