home | schedules | software | help | who we are | about | workshops | links | data access | contact us | print version

<  December 2009 >
Su Mo Tu We Th Fr Sa
    1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

Reserve a classroom


Schedule for
12/07/2009


Main Lab
140 Prospect St.
Room 101
11am- 12:15pm STAT 625
2:30- 3:45pm Stat 360/361
5- 6pm ECON 546

Rosenkranz Hall
115 Prospect St.
Room 01
9:25am- 11:15am PLSC 504
2- 2:50pm SOC 580a

Consultant's Desk
140 Prospect St.
Room 100
10am- 2pm No Consultant On Duty
2- 6pm Taylor Arnold
6- 10pm No Consultant On Duty


schedules

software

help

who we are

data access

about

workshops

links

S-Plus FAQ


How can I import my data from non-Splus files?

Go to File > Import Data > From File. Then locate your data set and choose it. S-Plus can import most non-Splus data sets, for instance, SAS, SPSS, STATA, Excel, ASCII etc.

How can I export my data set into non-Splus format?

Yes. Go to File > Export Data > To File. Then choose the desired data format. S-Plus objects can saved into most non-Splus formats, for instance, SAS, SPSS, STATA, Excel, ASCII etc.

I use S-Plus on both Windows and Unix machines. Is there a way that I can transfer my work on the two platforms?

Some people try to copy and paste the whole "_Data" directory. But I find that many times the two systems do not recognize each other. A safer way is to use the "data.dump" and "data.source" functions. In the source computer, type

>  data.dump(ls(), "a:\\Current.txt")
In the S-Plus of the destination computer, type
>  data.source("a:\\Current.txt")
Some people use "dump" and "source" command. But these older version commands have some drawbacks. For instance, the restoration of large data objects that were created by "dump" may take inordinate amounts of memory. "source" will not be able to properly read an object with a call component

Why am I having problems doing computations on "numeric" S-Plus objects?

This is most likely because the objects you are working on are not "numeric". S-Plus uses several different structures to store its data objects. Some numeric variables in your original file could be imported as "character", "list" or some other non-numeric objects. This happens often when your original file has both characters and numbers.
To check the types of structure your objects are stored, you can type:

> mode(MySObject)
If it is not a list, then
> MySObject2_as.numeric(MySObject)
would solve the problem. If the mode is a list, try:
> My Sobject2_unlist(MySObject)

How do I remove the variables I do not need in my data set, or add new variables to existing data set?

Suppose your data set is called "MyDataFrame". If each column represents a variable, and you want to delete the variables called "salary" and "gender", try

>  MyDataFrame2_MyDataFrame[, -c("salary", "gender")]
Or if these two variables happen to be the first and second column, you can simply key in
>  MyDataFrame2_MyDataFrame[, -c(1,2)]
or
>  MyDataFrame2_MyDataFrame[, -1:2]
To add a new variable, for instance, the log of salary, to the existing data frame, type:
>  MyDataFrame2[, "NewVariableName"]_log(MyDataFrame[, "salary"])
If in your data each row represents a variable (this is rare), you just need to change the position of the comma. For instance, the first command will be changed to:
>  MyDataFrame2_MyDataFrame[-c("salary", "gender"), ]

How do I remove some observations in my data set?

If your data is a vector, and you want to remove the fourth and the sixth observations, use

> MyVector2_MyVector[-c(4,6)]
If your data is a data frame, use
> MyVector2_MyVector[-c(4,6), ]
In more complicated cases, using function "rep" can greatly reduce the work. For instance, you have a panel data of 5 countries' GDPs for 10 years. It looks like:
> PanelData

	 countries 	 year		 GDP  		# variable names
	Country 1	Year 1		GDP1 		# the first record
	Country 1	Year 2		GDP2
	Country 1	Year 3		GDP3
	….		….		…..
	Country 1	Year 10	GDP10
	Country 2	Year 1		GDP1
	….		….		…..
    

You want to do an autoregressive regression with lag 1. Your "y" will be the GDPs from year 2 to year 10, and your "x" will be the GDPs from year 1 to year 9. You can use the following command to get your "y" variable and "x" variable.

> flag.y_rep(c(F, rep(T,9)),5)
# This is to create a logic vector that tells S-Plus what observations will be "y";
> flag.x_rep(c(rep(T,9),F),5)
# This is to create a logic vector that tells S-Plus what observations will be "x";
        > y_PanelData[flag.y, "GDP"]
        > x_PanelData[flag.x, "GDP"]

How can I make S-Plus print less digits?

        > options(digits=3)
        > print(pi)
    3.14

©2007 Yale University
Social Science Statistical Laboratory
Certifying Authority: Themba Flowers
lm: Thu Apr 17 11:56:14 EDT 2003