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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:41:19+00:00 2026-05-27T17:41:19+00:00

I am working with a data set that has a column with values that

  • 0

I am working with a data set that has a column with values that I would like to transform.
The problem that I have right now is that my data looks like:

  1. Site Count
  2. 1 1 35
  3. 1 10 38
  4. 1 2 56
  5. 1 3 23
  6. 1 4 25
  7. 1 5 45
  8. …….

I would like to remove the 1 that is present in all the sites and just leave it 1, 2, 3, 4, 5… 10.

I tried to transform it using as.number but it gives me the site 1.10 as the second value so it is not right.

  • 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-27T17:41:20+00:00Added an answer on May 27, 2026 at 5:41 pm

    An example dataset:

    dat = data.frame(site = paste(1, 1:10), 
                     count = round(runif(10, 1, 10)))
    

    To get rid of the 1 bit:

    dat$site = sub("1 ", "", dat$site)
    

    Here I use sub to substitute the 1 by an empty string. The transformation to numeric then works:

    dat$site = as.numeric(dat$site)
    > dat$site
     [1]  1  2  3  4  5  6  7  8  9 10
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working with a set of data that looks something like the following.
I am working with a set of data that I have converted to a
I have a working program in C++ that generates data for a Mandelbrot Set.
I am currently working on a problem that I have an inelegant solution for.
Right now I have a Rails 3 model for storing profile data. One of
I'm working on a webapp with a set of data that users can browse
While working on my Silverlight4 SketchFlow prototype I have a datagrid that has a
I was wondering... when working with a fixed set of data (say: the population
I have an Excel Column which has number format as dd-mm-yyyy . Formatting of
I'm working with a large set of legacy data (converted from a flat-file db),

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.