Académique Documents
Professionnel Documents
Culture Documents
Note: Before using this information and the product it supports, read the general information under Notices on p. 80. This edition applies to IBM SPSS Statistics 21 and to all subsequent releases and modications until otherwise indicated in new editions. Adobe product screenshot(s) reprinted with permission from Adobe Systems Incorporated. Microsoft product screenshot(s) reprinted with permission from Microsoft Corporation. Licensed Materials - Property of IBM
Copyright IBM Corporation 1989, 2012.
Contents
1 Using the R Integration Package for IBM SPSS Statistics 1
Working with R Program Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 R Syntax Rules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Retrieving Variable Dictionary Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Reading Case Data from IBM SPSS Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Writing Results to a New IBM SPSS Statistics Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Creating Pivot Table Output. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Displaying Graphical Output from R. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Retrieving Output from Syntax Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Localizing Output from R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Modifying the R code. . . . . . . Extracting translatable text . . Translating the pot file . . . . . . Installing the mo files. . . . . . . ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... 20 21 21 21
GetSPSSVersion Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 spssdata Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 spssdata.CloseDataConnection Function . . . . spssdata.GetCaseCount Function. . . . . . . . . . spssdata.GetDataFromSPSS Function . . . . . . spssdata.GetDataSetList Function . . . . . . . . . spssdata.GetFileHandles Function . . . . . . . . . spssdata.GetOpenedDataSetList Function . . . spssdata.GetSplitDataFromSPSS Function . . . spssdata.GetSplitVariableNames Function. . . spssdata.IsLastSplit Function. . . . . . . . . . . . . spssdata.SetDataToSPSS Function . . . . . . . . spssdictionary Functions . . . . . . . . . . . . . . . . . . . ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... 45 45 45 48 48 48 49 50 50 51 51
spssdictionary.CloseDataset Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
iii
spssdictionary.CreateSPSSDictionary Function . . . . . . . . . . . spssdictionary.EditCategoricalDictionary Function. . . . . . . . . spssdictionary.EndDataStep Function . . . . . . . . . . . . . . . . . . spssdictionary.GetCategoricalDictionaryFromSPSS Function . spssdictionary.GetDataFileAttributeNames Function . . . . . . . spssdictionary.GetDataFileAttributes Function . . . . . . . . . . . . spssdictionary.GetDictionaryFromSPSS Function. . . . . . . . . . spssdictionary.GetMultiResponseSetNames Function . . . . . . spssdictionary.GetMultiResponseSet Function. . . . . . . . . . . . spssdictionary.GetUserMissingValues Function . . . . . . . . . . . spssdictionary.GetValueLabels Function . . . . . . . . . . . . . . . . spssdictionary.GetVariableAttributeNames Function . . . . . . . spssdictionary.GetVariableAttributes Function . . . . . . . . . . . . spssdictionary.GetVariableCount Function . . . . . . . . . . . . . . . spssdictionary.GetVariableFormat Function . . . . . . . . . . . . . . spssdictionary.GetVariableFormatType Function . . . . . . . . . . spssdictionary.GetVariableLabel Function . . . . . . . . . . . . . . . spssdictionary.GetVariableMeasurementLevel Function . . . . spssdictionary.GetVariableName Function . . . . . . . . . . . . . . . spssdictionary.GetVariableType Function . . . . . . . . . . . . . . . . spssdictionary.GetWeightVariable Function . . . . . . . . . . . . . . spssdictionary.IsWeighting Function . . . . . . . . . . . . . . . . . . . spssdictionary.SetActive Function . . . . . . . . . . . . . . . . . . . . . spssdictionary.SetDataFileAttributes Function . . . . . . . . . . . . spssdictionary.SetDictionaryToSPSS Function . . . . . . . . . . . . spssdictionary.SetMultiResponseSet Function. . . . . . . . . . . . spssdictionary.SetUserMissing Function . . . . . . . . . . . . . . . . spssdictionary.SetValueLabel Function . . . . . . . . . . . . . . . . . spssdictionary.SetVariableAttributes Function . . . . . . . . . . . . spsspivottable.Display Function . . . . . . . . . . . . . . . . . . . . . . . . . .
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
52 53 54 54 55 55 55 57 57 57 58 59 59 60 60 61 61 61 62 62 62 62 63 63 63 64 65 66 66 67
spsspkg.EndProcedure Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 spsspkg.GetOutputLanguage Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 spsspkg.GetSPSSLocale Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 spsspkg.GetSPSSPlugInVersion Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 spsspkg.GetSPSSVersion Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 spsspkg.GetStatisticsPath Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 spsspkg.processcmd Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 spsspkg.SetOutput Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 spsspkg.SetOutputLanguage Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 spsspkg.StartProcedure Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 spsspkg.Syntax Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 spsspkg.Template Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 spsspkg.Version Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
iv
spssRGraphics Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 spssRGraphics.Submit Function. . . . . . . . . . . spssRGraphics.SetOutput Function . . . . . . . . spssRGraphics.SetGraphicsLabel Function . . spssxmlworkspace Functions . . . . . . . . . . . . . . . . ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... 75 76 76 76 76 77 77 77 78
spssxmlworkspace.CreateXPathDictionary Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . spssxmlworkspace.DeleteXmlWorkspaceObject Function . . . . . . . . . . . . . . . . . . . . . . . . . . . spssxmlworkspace.EvaluateXPath Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . spssxmlworkspace.GetHandleList Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TextBlock Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
append Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Chapter
The R Integration Package for IBM SPSS Statistics provides the ability to use R programming features within SPSS Statistics. This feature requires the IBM SPSS Statistics - Integration Plug-in for R, installed with IBM SPSS Statistics - Essentials for R. Within SPSS Statistics, R programming features are available inside BEGIN PROGRAM R-END PROGRAM program blocks in command syntax, as well as from implementation code for extension commands implemented in R. Within these structures, you have access to both the R programming language and the functions specic to SPSS Statistics, provided in the R Integration Package for SPSS Statistics. These functions allow you to: