不急,慢慢来,刚学都是这样的,等熟练了以后就轻松了!
出现+号 是程序不完整,建议在半角下重新写一下 ""和()。SPLUS只能识别半角下的标点符号!
importData是SPLUS用来读入外部数据的主要函数。它的功能非常强大。
USAGE:
importData(file=NULL, type="", keep=character(0), drop=character(0),
colNames=character(0), rowNamesCol=-1, filter=character(),
format=character(0), delimiter=<<see below>>,
startCol=1, endCol=-1, startRow=1, endRow=-1, pageNumber=-1, colNameRow=-1,
server="", user="", password="", database="", table="",
stringsAsFactors=<<see below>>, sortFactorLevels=T,
valueLabelAsNumber=F, centuryCutoff=1930, separateDelimiters=T,
odbcConnection=character(0), odbcSqlQuery=character(0),
sqlQuery=character(0), readAsTable=F, colNamesUpperCase=F,
time.in.format=character(0), decimal.point=".", thousands.separator=",",
time.zone="GMT", use.locale=F, sqlReturnData=T,
scanLines=max(startRow, 256), maxLineWidth=0, na.string="NA",
colTypes=character(0), bigdata=F)
OPTIONAL ARGUMENTS:
file
a character string specifying the name of the file to import. If the file has a known suffix (see the type argument below), S-PLUS assumes the file is of that type. This can be overridden by providing type explicitly. The file argument is not required if importing from a relational database.
type
a character string specifying the type of file to import. Possible values are listed here; the case of the character string is ignored.
"ACCESS"
Microsoft Access file. This file type is available only in S-PLUS for Windows. See the DETAILS section for information on import/export limitations. File suffix: mdb.
"ASCII"
ASCII text. 32k is the maximum import/export character string length. File suffix: asc, csv, or txt. S-PLUS for Windows also recognizes the suffixes dat and prn.
"DBASE"
dBase or other xBase file. File suffix: dbf.
"DIRECT-DB2"
DB2 database connection. See the DETAILS section for information on import/export limitations. No file argument should be specified.
"DIRECT-ORACLE"
Oracle database connection. See the DETAILS section for information on import/export limitations. No file argument should be specified.
"DIRECT-SQL"
Microsoft SQL Server database connection. See the DETAILS section for information on import/export limitations. No file argument should be specified. This option is available only in S-PLUS for Windows.
"DIRECT-SYBASE"
Sybase database connection. No file argument should be specified.
"EPI"
Epi Info file. File suffix: rec.
"EXCEL"
Microsoft Excel worksheet file. 32k is the maximum import/export character string length. File suffix: xls.
"FASCII"
Formatted ASCII text file. File suffix: fix. S-PLUS for Windows also recognizes the suffix fsc.
"FOXPRO"
FoxPro file. This file type is available only in S-PLUS for Windows. File suffix: dbf.
"GAUSS"
Aptech Gauss data file (old format). Unix exports GAUSS files in GAUSS96 format. File suffix: dat.
"GAUSS96"
Aptech Gauss data file (new format). File suffix: dat.
"LOTUS"
Lotus 123 worksheet file. File suffix: wk* or wr*.
"MATLAB"
Matlab file. The file must contain a single matrix. File suffix: mat.
"MINITAB"
Minitab workbook. In S-PLUS for UNIX, the file must be from Minitab Version 11 or earlier. File suffix: mtw.
"ODBC"
ODBC connection. This file type is available only in S-PLUS for Windows. When you specify "ODBC" , you must also specify the argument odbcConnection. You can also specify the argument odbcSqlQuery with this type. For more information, see the ODBC arguments described below.
"ORACLE"
Oracle database connection. Same as "DIRECT-ORACLE". No file argument should be specified.
"PARADOX"
Paradox data file. This file type is available only in S-PLUS for Windows. File suffix: db.
"QUATTRO"
Quattro Pro worksheet file. File suffix: wq* or wb*.
"SAS", "SAS6WIN"
SAS Version 6.x data file from Windows or OS/2. File suffix: sd2.
"SAS1", "SAS6UX32"
SAS Version 6.x data file from HP, IBM or Sun UNIX. File suffix: ssd01.
"SAS4", "SAS6UX64"
SAS Version 6.x data file from Digital/Compaq/HP Tru64 UNIX. File suffix: ssd04.
"SAS7"
SAS Version 7 or later data file from Windows or UNIX. File suffix: sas7bdat.
"SAS7WIN"
SAS Version 7 or later data file from Windows. This is equivalent to the "SAS7" file type since the platfrom is autodetected. File suffix: sas7bdat.
"SAS7UX32"
SAS Version 7 or later data file from Solaris (SPARC), HP-UX, or IBM AIX. This is equivalent to the "SAS7" file type since the platfrom is autodetected. File suffix: sas7bdat.
"SAS7UX64"
SAS Version 7 or later data file from Digital/Compaq/HP Tru64 UNIX. This is equivalent to the "SAS7" file type since the platfrom is autodetected. File suffix: sas7bdat.
"SAS_TPT"
SAS transport file. File suffix: tpt or xpt.
"SIGMAPLOT"
SigmaPlot data file. This file type is available only in S-PLUS for Windows. File suffix: jnb.
"SPLUS"
S-PLUS transport file. Files in this format can also be written and read with the data.dump and data.restore functions. File suffix: sdd.
"SPSS"
SPSS data file. File suffix: sav.
"SPSSP"
SPSS portable data file. File suffix: por.
"STATA"
Stata Version 2.0 or later data file. File suffix: dta.
"SYBASE"
Same as "DIRECT-SYBASE". Sybase database connection. No file argument should be specified.
"SYSTAT"
Systat data file. File suffix: sys. S-PLUS for Windows also recognizes the suffix syd.