| To: | "Jourdan Gold" <jgold@uoguelph.ca>, s-news@lists.biostat.wustl.edu |
|---|---|
| Subject: | Re: Manipulated imported data from the command window |
| From: | "Liz von Moos" <lizvonmoos@gmail.com> |
| Date: | Sat, 10 Jan 2009 19:36:40 -0500 |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:in-reply-to:mime-version:content-type:references :x-google-sender-auth; bh=pgwrIEI19iOu7ujCqhtQ6WF81JW0NjiohhaLLJYrIRw=; b=j3oQIbaVJPTpd32QRqACcq2OY/6X0tGphXNxGNzsKlu2F3Dt5mBQuizPqat1Y2IndF /77TblV0/sDjX5fNh+XpNLZT2TZWWjJoofYXMvWExqvYezsgjCHI9Qs2AMEOV3Zl6u/H 1fSDwbAw1dioS+INZm3ZZqn9AE9RbYFY0P/OU= |
| Domainkey-signature: | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:in-reply-to:mime-version :content-type:references:x-google-sender-auth; b=i6fgbqj5X6MiiqDXREMrHKACXlgR+wA8D5Y+WsgW0LHERSg6zJW5jPP1xWfNo3ybos rpjchX1Qz2Q9VBUf0+/guux/GB4Mc7VsB+fDhy//u7nhIGdfuZVkm1LM9/I5UsoCE/Nu bfYyOB3YdVBRL9JCU7BoySFbLesUViUdtEBPI= |
| In-reply-to: | <1841903435.1963251231542676504.JavaMail.root@huron.cs.uoguelph.ca> |
| References: | <c85d407b0901091414q2e64349o353ba5ccc06aad4d@mail.gmail.com> <1841903435.1963251231542676504.JavaMail.root@huron.cs.uoguelph.ca> |
|
Thank you very much for your replies. I apologize that my first email was so vague. It seems that there are learning curves everywhere for me. I am also new to user groups so please correct me if I am using I am using it incorrectly. First, I am using the version 8.04 of S-Plus with a WindowsXP machine. I am having trouble enterring my data into a data frame in such a way that I can call the aov function on it. The example I am using here is from the Online Manual "Guide to Statistics Volume 1 found under the Help tab in S-Plus. This is the data table I am working with:
Consequently, I create the following (as per the online manual). > fnames <- list(treatment=LETTERS[1:4], + poisons=c("I", "II", "III")) > poisons.design <- fac.design(c(4,3), fnames, rep=4) I understand the design and purpose of the preceeding lines. The manual then suggests that the data from the table given above be enterred using scan(): > serv.time <- scan() 1: .31 .82 .43 .45 5: .36 .92 .44 .56 9: .22 .3 .23 .3 13: .45 1.10 .45 .71 17: .29 .61 .35 1.02 21: .21 .37 .25 .36 25: .46 .88 .63 .66 29: .40 .49 .31 .71 33: .18 .38 .24 .31 37: .43 .72 .76 .62 41: .23 1.24 .40 .38 45: .23 .29 .22 .33 49: and then the poisons data frame is created: > poisons.df <- data.frame(poisons.design, serv.time) From here, the aov fuction can be applied. So far so good. Here's the problem: my own data is quite a lot larger than the sample data set used above so enterring the data manually (using scan()) is impractical. I therefore import my data using the import data function from the file drop-down menu. Then I can look at the data in the command window (I will continue to use the data from the example above in order to illustrate my problem). My data now looks like this (I've called it "mydata"): > mydata C7 C8 C9 C10 1 0.31 0.82 0.43 0.45 2 0.45 1.10 0.45 0.71 3 0.46 0.88 0.63 0.66 4 0.43 0.72 0.76 0.62 5 0.36 0.92 0.44 0.56 6 0.29 0.61 0.35 1.02 7 0.40 0.49 0.31 0.71 8 0.23 1.24 0.40 0.38 9 0.22 0.30 0.23 0.30 10 0.21 0.37 0.25 0.36 11 0.18 0.38 0.24 0.31 12 0.23 0.29 0.22 0.3 I then transpose columns to rows: > bd.tranpose(mydata) X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 1 0.31 0.45 0.46 0.43 0.36 0.29 0.40 0.23 0.22 0.21 0.18 0.23 2 0.82 1.10 0.88 0.72 0.92 0.61 0.49 1.24 0.30 0.37 0.38 0.29 3 0.43 0.45 0.63 0.76 0.44 0.35 0.31 0.40 0.23 0.25 0.24 0.22 4 0.45 0.71 0.66 0.62 0.56 1.02 0.71 0.38 0.30 0.36 0.31 0.33 Here's the tricky part. I now need all of the data to be enterred as one long sequence (as the scan() call allowed me to do). That is, I would like X1 to be followed by X5, then X9, then X2, then X6, etc. Put another way, I would like my data to end up looking like *this* when I call it by it's name: [1] 0.31 0.82 0.43 0.45 0.36 0.92 0.44 0.56 0.22 ... etc. I'm stumped as to how to affect this transposition using append() or bd.append(). I can accomplish what I want to do using the data window and data->transform->stack in the drop-down menu but I have not been able to figure out how to do this using the command window. Perhaps I'm going about this backwards and should instead be modifying the nature of the list and design of the data frame? If I can affect the necessary transformation with this sample data, I should be off to the races with my own data. Thank you for your patience with this new S-PLUS user. I will gladly clarify where necessary. Liz On Fri, Jan 9, 2009 at 6:11 PM, Jourdan Gold <jgold@uoguelph.ca> wrote: can you send an example of the data structure. It is difficult to guess what you want without any commands / data or error messages. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: Manipulated imported data from the command window, Barker, Chris |
|---|---|
| Next by Date: | Re: Manipulated imported data from the command window, Samer Mouksassi |
| Previous by Thread: | Re: Manipulated imported data from the command window, Barker, Chris |
| Next by Thread: | Re: Manipulated imported data from the command window, Samer Mouksassi |
| Indexes: | [Date] [Thread] [Top] [All Lists] |