Solve R speed Too slow problem

Source: Internet
Author: User

R Slow has been criticized, recently done a larger dataset analysis, ran too slow, found that the crux is R Data frame index too slow:

The following tests are:

Gene_list = 1:100000= matrix (nrow = Length (gene_list), Ncol = 7= As.data.frame (Matrix (nrow = Length (gen e_list), Ncol = 7=return(1:7)#  test eqtlsystem.time (         return  (Try_func () )))

# # User System elapsed

# # 0.108 0.001 0.108

System.time (        for in 1: Length (gene_list)) {                 = try_func ()        })


# # 0.137 0.000 0.138


System.time ( for in 1: Length (gene_list)) { = try_func () })

# # User System elapsed

# # 90.623 165.868 259.065

System.time (        for in 1: Length (gene_list)) {        = 1:7        })

# # User System elapsed
  # # 0.089 0.000 0.090

Did you see the results? It's too shock! Data frame is really not suitable for big data!

Solve R speed Too slow problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.