最近,我需要分析一個以列和行形式存儲數據的網站的數據。 主行中的每個列單元格都與左上角的單元格(標題)相關。 但是,每個標題下面都有兩個單元格(後續兩行中的第一個單元格)。 一個包含標題的描述;另一個包含與標題相關的內容標籤。
不幸的是,該網頁未設置為允許我使用 JMP File>Internet Open 導入為 .html 或 .txt。 所以,我剪切並粘貼到 Excel 中。 JMP 系統工程師同事 Olivia Lippincott @O_Lippincott ,說對於她遇到的Excel用戶,Excel格式(圖1)很常見,她經常幫他們清理。
需要將多行拆分為單獨的列。 我們就是這樣做的。
首先,我們打開Excel文件到JMP .
Figure 1: Table of Excel data imported into JMPFigure 1: Table of Excel data imported into JMPFigure 1: Table of Excel data imported into JMPFigure 1: Table of Excel data imported into JMP圖 1:導入 JMP 的 Excel 數據表其次,我們創建了一個名為 Title Type 的新列,其中 Column Properties Data Type = Numeric 和 Modeling Type = Nominal。 我們通過在 Title Type 列的前三個單元格中鍵入 1、2 和 3,突出顯示它們,然後選擇 FILL>REPEAT SEQUENCE TO END OF TABLE,以重複序列 1、2、3 填充單元格。 這為我們提供了一個 ID 列,用於標識 Title 字段模式。
Figure 2: Add Title Type to identify the pattern 1-3 for the three Title TypesFigure 2: Add Title Type to identify the pattern 1-3 for the three Title TypesFigure 2: Add Title Type to identify the pattern 1-3 for the three Title TypesFigure 2: Add Title Type to identify the pattern 1-3 for the three Title Types圖 2:添加標題類型以識別三種標題類型的模式 1-3第三,我們拆分錶 (TABLE>SPLIT) 以將 Title Type 2 和 Title Type 3 分成兩個不同的列。 我也將腳本保存到數據表中,以供參考。
Figure 3: Splitting Title Column into 3 columns by Title TypeFigure 3: Splitting Title Column into 3 columns by Title TypeFigure 3: Splitting Title Column into 3 columns by Title TypeFigure 3: Splitting Title Column into 3 columns by Title Type圖 3:按標題類型將標題列拆分為 3 列
Figure 4: JSL script to split Title Column into 3 columns by Title TypeFigure 4: JSL script to split Title Column into 3 columns by Title TypeFigure 4: JSL script to split Title Column into 3 columns by Title TypeFigure 4: JSL script to split Title Column into 3 columns by Title Type圖 4:將標題列按標題類型拆分為 3 列的 JSL 腳本
第四,我們移動了一些列,將標題 Title Type 2 重命名為 Description,將 Title Type 3 重命名為 Tags。最後,我們擺脫了領導標籤:通過重新編碼標記列上的文本標籤:使用“重新編碼”紅色小三角下方的“替換字符串”選項添加到空白區域。
Figure 5: Accessing Column Recode using Replace StringFigure 5: Accessing Column Recode using Replace StringFigure 5: Accessing Column Recode using Replace StringFigure 5: Accessing Column Recode using Replace String圖 5:使用替換字符串訪問列重新編碼
Figure 6: Using Recode to replace consistent Tags: text found in each cell in a columnFigure 6: Using Recode to replace consistent Tags: text found in each cell in a columnFigure 6: Using Recode to replace consistent Tags: text found in each cell in a columnFigure 6: Using Recode to replace consistent Tags: text found in each cell in a column圖 6:使用 Recode 替換一致的標籤:在列中的每個單元格中找到的文本
Figure 7. Final Videos Table ready for JMP analysisFigure 7. Final Videos Table ready for JMP analysisFigure 7. Final Videos Table ready for JMP analysisFigure 7. Final Videos Table ready for JMP analysis圖 7。 準備好進行 JMP 分析的最終視頻表
使用 JMP 的整個清理過程大約需要 1 分鐘。 也許這些步驟將在您自己的數據清理和準備過程中為您提供幫助。