Introduction
This article describes how to go from a multiple column table with more than one statistic and nested data...
...to returning only the cells you need.
Requirements
A multiple-column table with multiple statistics and nested data created by including a Nominal-Multi question as the Row question used in your table. If you're using a table with a nested banner, please see How to Work with Nested Banners and Spans in R Tables.
Method 1 - Point and click
1. Click on the Calculation equal sign.
2. Click on the page to insert a calculation box on the page.
3. While the cursor is blinking (active) in the R CODE box, click on a part of a table that you'd like to extract.
See Bespoke Analyses for examples and a demo of the feature. Note that if you are using point and click with a nested banner, you must use the banner numbers and not the column label, since it is repeated.
Method 2 - By name
1. Select your table
2. Copy the name from Properties > GENERAL > Name
3. Select Calculation > Custom Code.
4. Go to Properties > R CODE in the object inspector.
5. To check the table dimensions, write dimnames(table_name)
using the name from step 2 and you will return a list of names for each dimension of your table:
5. Using this definition, we need to add a line in the format of table_name[row_name, column_name, nested_column_name, statistic_name]
Using our example, the code to return just the percentage for females who love Coca-Cola is:
table.gender.brand.attitude["Coca-Cola","Love","Female","Column %"]
To instead return percentages for everyone who likes or loves Coca-Cola is:
table.gender.brand.attitude["Coca-Cola",c("Like","Love"),,"Column %"]
Leaving one of these arguments empty will return all the rows, columns or statistics respectively from the table.
Below the Hate - Love argument has been removed from above so it returns all ratings:
6. OPTIONAL: Add a percentage sign or adjust the number of decimal places via Properties > APPEARANCE > Number format.
Method 3 - By index
1. Select your table
2. Copy the name from Properties > GENERAL > Name
3. Select Calculation > Custom Code.
4. Go to Properties > R CODE in the object inspector.
5. Using the definition from method 1 step 4, we need to add a line in the format of table_name[row_index, column_index, nested_column_index, statistic_index]
Using our example, the code to return the percentage the percentage for females who love Coca-Cola is: table.gender.brand.attitude[1,5,2,1]
To instead return percentages of everyone who likes or loves Coca-Cola is: table.gender.brand.attitude[1,c(4,5),,1]
Alternatively, you can use index ranges, whereby the above can also be written as: table.gender.brand.attitude[1,c(4:5),,1]
You can even reverse this to remove the other ratings instead: table.gender.brand.attitude[1,c(-1:-3,-6),,1]
You can additionally keep only the last cola category by using the NROW argument:
table.gender.brand.attitude[NROW(table.gender.brand.attitude),,,]
6. OPTIONAL: Add a percentage sign or adjust the number of decimal places via Properties > APPEARANCE > Number format.
See also
How to Work with Nested Banners and Spans in R Tables
How to Extract Data from a Single Column Summary Table
How to Extract Data from a Multiple Column Table
How to Extract Data from a Multiple Column Table with Multiple Statistics
Comments
0 comments
Article is closed for comments.