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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:53:27+00:00 2026-06-11T19:53:27+00:00

My question today refers to a data frame I’m working on in R. The

  • 0

My question today refers to a data frame I’m working on in R.
The header of the data frame looks like the following: String(unique), Integer N[0-23]

Those 24 Integer values represent the frequency of the String associated with each hour of the day. Logically, the int values in each row sum up to the number how often the string appears in the data in general.

Thing is, I don’t need the real frequency of the string at a certain hour but the percentage this frequency represents in relation to the sum of the integer values in all rows.

My lecturer hinted that table() might be the right R tool for that but I honestly don’t understand how that is supposed to help me.

If all else fails, I’ll calculate it in Java – although I’d really appreciate your help to do this in R.

Thanks for reading so far and thanks in advance for your help,

Rickyfox

@@@@@@I am your edit, read me @@@@@@

With the help I got from James I got the following proptable

Thing is, the percentages sum up to 100 for each row, but they should do so for the whole table. Is there a way to do that?

  • 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-11T19:53:29+00:00Added an answer on June 11, 2026 at 7:53 pm

    Use prop.table on a matrix containing the values:

    x <- data.frame(id=letters[1:3],val0=1:3,val1=4:6,val2=7:9)
    prop.table(as.matrix(x[-1]),margin=1)
               val0      val1      val2
    [1,] 0.08333333 0.3333333 0.5833333
    [2,] 0.13333333 0.3333333 0.5333333
    [3,] 0.16666667 0.3333333 0.5000000
    

    Edit: A fully working example:

    tt=read.table("topichitsperhod.csv",sep=",",header=TRUE)  
    tt=na.omit(tt[-1])
    pt=prop.table(tt[-1],margin=NULL)
    

    First column is being left out because it held the topic strings.

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

Sidebar

Related Questions

A friend of mine was asked the following question today at interview for the
So I was asked this question today. Integer a = 3; Integer b =
Simple question today: Is it better to return query data in a struct or
today's question involves URLLoader requests using encrypted strings. when I encrypt a string I
I have a question that in today's movies like Kung fu panda,Rio etc,Is there
(second question today - must be a bad day) I have a dataframe with
I was asked this question today by a colleague, and couldn't find any clue
I ran into this question today and thought I should post it for the
Somebody ask me this question today . What is the need of reference in
A friend asked me a question today about an assignment problem. I found 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.