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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:02:44+00:00 2026-06-03T15:02:44+00:00

I have a table of several columns, with values from 1 to 8. The

  • 0

I have a table of several columns, with values from 1 to 8. The columns have different lenghts so I have filled them with NAs at the end. I would like to transform each column of the data so I will get something like this for each column:

        1  2  3  4  5  6  7  8
0-25    1  0  0  0  0  1  0  2
25-50   5  1  2  0  0  0  0  1
50-75   12 2  2  3  0  1  1  1
75-100  3  25 1  1  1  0  0  0

where the row names are percentages of the actual length of the original column (i.e. without the NAs), the column names are the original 0 to 8 values, and the new values are the number of occurances of the original values in each percentage. Any ideas will be appreciated.

Best,

Lince

PS/ I realize that my original message was very confusing. The data I want to transform contain a number of columns from time series like this:

1
1
8
1
3
4
1
5
1
6
2
7
1
NA
NA

and I need to calculate the frequency of occurences of each value (1 to 8) at the 0-25%, 25-50% et cetera of the series. Joris’ answer is very useful. I can work on it. 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-06-03T15:02:45+00:00Added an answer on June 3, 2026 at 3:02 pm

    Given the lack of some information, I can offer you this :

    Say 0 is no occurence, and 1 is occurence. Then you can use the following little script for the results of one column. Wrap it in a function, apply it over the columns and you get what you need.

    x <- c(1,0,0,1,1,0,1,0,0,0,1,0,1,1,1,NA,NA,NA,NA,NA,NA)
    
    prop <- which(x==1) / sum(!is.na(x))*100
    result <- cut(prop,breaks=c(0,25,50,75,100))
    table(result)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with something like a dozen different columns. Is there a
I have table A and table B with Table A having several columns including
I have a table called scheduler_sched which has several columns, including a column called
I have a table, for example, mytable. It has several columns: col1, col2, col3.
I have a table with several employees. They have the following columns empid,datecolumn1,is_valid. Very
I have a large table (of sites) with several numeric columns - say a
We have a table T which contains a several char(8) columns (implicitly) which under
I have a table with multiple indexes, several of which duplicate the same columns:
I have several table related to multilingual Photo Galley like AlbumCategories AlbumName Photos PhotoDetails
I have several JTables with several columns each. Each table is displayed on a

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.