• Home
  • About Us
  • Contact Us
  • Privacy Policy
  • Special Offers
Business Intelligence Info
  • Business Intelligence
    • BI News and Info
    • Big Data
    • Mobile and Cloud
    • Self-Service BI
  • CRM
    • CRM News and Info
    • InfusionSoft
    • Microsoft Dynamics CRM
    • NetSuite
    • OnContact
    • Salesforce
    • Workbooks
  • Data Mining
    • Pentaho
    • Sisense
    • Tableau
    • TIBCO Spotfire
  • Data Warehousing
    • DWH News and Info
    • IBM DB2
    • Microsoft SQL Server
    • Oracle
    • Teradata
  • Predictive Analytics
    • FICO
    • KNIME
    • Mathematica
    • Matlab
    • Minitab
    • RapidMiner
    • Revolution
    • SAP
    • SAS/SPSS
  • Humor

Applying Map function on specific arrays of nested list

July 15, 2020   BI News and Info
 Applying Map function on specific arrays of nested list

The output of a part of my scripts can be a list of list (e.g ccmppp1) or a list (e.g ccmppp2). I am using the following script to find the Root mean square of the nested list which is applied on the last element of each sublist and it worked well.

RootMeanSquare /@ (#[[All, -1]] & /@ ccmppp1)

However, when my output is a list (e.g ccmppp2) the above script gives the wrong output. Considering that I do not know if my output is a list or list of list which command should I use that works for both. Or should I use the If function which I prefer not to use?

ccmppp1 = {{{45.8144, -0.864685, 10.7009}, {42.6579, -0.863343, 10.01}, {44.2365, -0.830501, 10.3459}, {171.179, 305.888, -107.992}}, {{173.75, 306.062, -108.301}, {171.775, 307.219, -110.29}, {174.06, 307.508, -111.119}, {170.034, 307.95, -111.296}, {174.329, 309.043, -113.554}, {172.091, 309.352, -113.408}, {169.571, 309.361, -113.06}, {169.98, 311.135, -115.16}, {174.687, 311.218, -116.291}, {172.25, 311.487, -115.947}, {173.124, 312.642, -117.252}, {174.887, 312.839, -117.922}}, {{168.792, 313.106, -116.923}, {171.072, 313.217, -117.375}, {173.008, 314.374, -118.78}, {175.094, 314.559, -119.475}, {169.427, 314.727, -118.452}, {171.107, 314.919, -118.858}, {173.699, 315.855, -120.169}, {170.027, 316.188, -119.749}, {175.261, 316.204, -120.815}, {171.812, 316.454, -120.228}, {173.568, 317.473, -121.382}, {169.795, 317.828, -121.02}, {175.483, 318.03, -122.247}, {171.704, 318.423, -121.752}}}

ccmppp2 = {{171.812, 316.454, -120.228}, {173.568, 317.473, -121.382}, {169.795, 317.828, -121.02}, {175.483, 318.03, -122.247}, {171.704, 318.423, -121.752}, {173.455, 319.502, -122.871}, {175.579, 319.568, -123.379}, {171.569, 320.011, -122.921}, {172.051, 321.326, -123.958}, {173.959, 321.362, -124.319}, {175.775, 321.389, -124.718}, {172.506, 323.092, -125.281}, {174.385, 323.193, -125.675}, {176.134, 323.528, -126.258}, {174.903, 324.765, -126.81}, {173.108, 325.129, -126.751}, {176.3, 325.268, -127.376}, {174.762, 326.297, -127.72}, {176.462, 327.022, -128.426}, {176.555, 328.653, -129.344}, {178.005, 342.933, -137.562}, {178.125, 344.653, -138.456}, {178.235, 346.388, -139.252}, {75.5718, 436.359, -80.7434}, {76.131, 438.132, -87.7129}, {76.9078, 439.652, -94.7067}}

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange

Applying, Arrays, function, List, Nested, Specific
  • Recent Posts

    • PUNNIES
    • Cashierless tech could detect shoplifting, but bias concerns abound
    • Misunderstood Loyalty
    • Pearl with a girl earring
    • Dynamics 365 Monthly Update-January 2021
  • Categories

  • Archives

    • January 2021
    • December 2020
    • November 2020
    • October 2020
    • September 2020
    • August 2020
    • July 2020
    • June 2020
    • May 2020
    • April 2020
    • March 2020
    • February 2020
    • January 2020
    • December 2019
    • November 2019
    • October 2019
    • September 2019
    • August 2019
    • July 2019
    • June 2019
    • May 2019
    • April 2019
    • March 2019
    • February 2019
    • January 2019
    • December 2018
    • November 2018
    • October 2018
    • September 2018
    • August 2018
    • July 2018
    • June 2018
    • May 2018
    • April 2018
    • March 2018
    • February 2018
    • January 2018
    • December 2017
    • November 2017
    • October 2017
    • September 2017
    • August 2017
    • July 2017
    • June 2017
    • May 2017
    • April 2017
    • March 2017
    • February 2017
    • January 2017
    • December 2016
    • November 2016
    • October 2016
    • September 2016
    • August 2016
    • July 2016
    • June 2016
    • May 2016
    • April 2016
    • March 2016
    • February 2016
    • January 2016
    • December 2015
    • November 2015
    • October 2015
    • September 2015
    • August 2015
    • July 2015
    • June 2015
    • May 2015
    • April 2015
    • March 2015
    • February 2015
    • January 2015
    • December 2014
    • November 2014
© 2021 Business Intelligence Info
Power BI Training | G Com Solutions Limited