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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:14:00+00:00 2026-06-03T00:14:00+00:00

I have data that looks like this. And I want to find the maximum

  • 0

I have data that looks like this.
And I want to find the maximum and minimum densities
given the list of standard deviations (SD) and means (MEAN) below:

info0 info1 info2 SD Mean
10x     0       e0      0.38    1.14
10x     0       e2      0.74    1.48
10x     0       e4      1       1.85
10x     0       e6      1.24    2.27
10x     0.1     e0      0.35    1.13
10x     0.1     e2      0.69    1.44
10x     0.1     e4      0.96    1.82
10x     0.1     e6      1.21    2.23
10x     0.5     e0      0.34    1.12
10x     0.5     e2      0.67    1.4
10x     0.5     e4      0.95    1.75
10x     0.5     e6      1.19    2.17
10x     1       e0      0.29    1.09
10x     1       e2      0.59    1.32
10x     1       e4      0.87    1.66
10x     1       e6      1.11    2.06
10x     2       e0      0.23    1.06
10x     2       e2      0.5     1.24
10x     2       e4      0.79    1.54
10x     2       e6      1.04    1.9
10x     4       e0      0.22    1.0.5
10x     4       e2      0.41    1.15
10x     4       e4      0.65    1.37
10x     4       e6      0.91    1.7

I tried this but fail.

dat <- read.table("test.dat", header = TRUE)
densities <- apply(dat[, 4:5], 1, function(x) rnorm(n = 1000000, mean = x[2], sd = x[1]))

maxden <- max(densities)
minden  <- min(densities)

What’s the right way to do 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-06-03T00:14:02+00:00Added an answer on June 3, 2026 at 12:14 am

    Let me first suggest that you not operate on such a huge data set and such a large number of n in the rnorm. This makes it easy to throw a browser in the code and figure out what’s happening. First the means in your data is a factor because of something you did with formatting.

     str(dat)
    'data.frame':   24 obs. of  5 variables:
     $ info0: Factor w/ 1 level "10x": 1 1 1 1 1 1 1 1 1 1 ...
     $ info1: num  0 0 0 0 0.1 0.1 0.1 0.1 0.5 0.5 ...
     $ info2: Factor w/ 4 levels "e0","e2","e4",..: 1 2 3 4 1 2 3 4 1 2 ...
     $ SD   : num  0.38 0.74 1 1.24 0.35 0.69 0.96 1.21 0.34 0.67 ...
     $ Mean : Factor w/ 24 levels "1.0.5","1.06",..: 6 13 19 24 5 12 18 23 4 11 ...
    

    That has to be addressed in the code.

    Now we can see use the code to get what we want (you’ll have to adjust the n in rnorm and supply more rows to the code when you actually use it but for testing purposes this was ideal):

    densities <- apply(dat[1:10, 4:5], 1, function(x) {
            rnorm(n = 10, mean = as.numeric(x[2]), sd = as.numeric(x[1]))
        }
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have data that looks like this: #info #info2 1:SRX004541 Submitter: UT-MGS, UT-MGS Study:
I have a data that looks like this . And I intend to create
I have a data that looks like this . And my code below simply
I have several data that looks like this: Vector1_elements = T,C,A Vector2_elements = C,G,A
I have a data that looks like this: 3 2 1 5 What I
I have a data that looks like this 1:SRX000566 Submitter: WoldLab Study: RNASeq expression
I have a data that looks like this: foo foo scaffold_7 1 4845 6422
I have a data file that looks like this: xyz123 2.000 -0.3974 0.0 hij123
I have a data object that looks like this: { 'node-16': { 'tags': ['cuda'],
I have some data that looks something like this... +----------+----------+----------+ | Column 1 |

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.