<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Statistical Consulting Center Forums - R</title>
        <description>Forum for the R statistical computing and graphical language and environment.</description>
        <link>http://forums.stat.ucla.edu/list.php?3</link>
        <lastBuildDate>Mon, 23 Nov 2009 22:48:51 -0800</lastBuildDate>
        <generator>Phorum 5.2.10</generator>
        <item>
            <guid>http://forums.stat.ucla.edu/read.php?3,39,39#msg-39</guid>
            <title>Setting Working Directory for Command-Line (3 replies)</title>
            <link>http://forums.stat.ucla.edu/read.php?3,39,39#msg-39</link>
            <description><![CDATA[ When using R from the command line, how do I tell R to use the current directory from which R is executed as the working directory without having to manually type it in R using setwd?]]></description>
            <dc:creator>Ryan Rosario</dc:creator>
            <category>R</category>
            <pubDate>Tue, 21 Apr 2009 23:42:08 -0700</pubDate>
        </item>
        <item>
            <guid>http://forums.stat.ucla.edu/read.php?3,14,14#msg-14</guid>
            <title>weights case (3 replies)</title>
            <link>http://forums.stat.ucla.edu/read.php?3,14,14#msg-14</link>
            <description><![CDATA[ In SPSS it's possible weights cases with a non-integer vector. How do I in R?<br />
For crosstabs is more simply with xtabs(weights~var1+....varn)<br />
For calculate correlation matrix view cov.wt. <br />
But I don`t have any idea for others methods, like homals.<br />
Thanks]]></description>
            <dc:creator>joscani</dc:creator>
            <category>R</category>
            <pubDate>Wed, 11 Mar 2009 18:07:00 -0700</pubDate>
        </item>
        <item>
            <guid>http://forums.stat.ucla.edu/read.php?3,9,9#msg-9</guid>
            <title>Question about creating (1 reply)</title>
            <link>http://forums.stat.ucla.edu/read.php?3,9,9#msg-9</link>
            <description><![CDATA[ Hi There,<br />
This is a pretty basic question but any help is appreciated:<br />
I'm having some trouble getting a loop to work and I believe it my problem is in how I am trying to extract the info from the table it is in.<br />
<br />
Thanks a ton for any help!<br />
<br />
here is the code I'm trying to get to work:<br />
<br />
# RESULTS TABLE<br />
(TblResults &lt;- data.frame(Motivations=names(TblTable1), n=0, n1=0, n2=0, n3=0, n4=0, n5=0, Median=0, Q25=0, Q75=0, IQRng=0))<br />
                              <br />
for (i in 1:nrow(TblResults)) {  <br />
   #Calculate Median and IQR for each Motivation<br />
   TblResults$n<i>       &lt;- nrow(TblTable1[,i])<br />
   TblResults$n1<i>      &lt;- nrow(TblAnalysis[TblTable1[,i]==1,])<br />
   TblResults$n2<i>      &lt;- nrow(TblAnalysis[TblTable1[,i]==2,])<br />
   TblResults$n3<i>      &lt;- nrow(TblAnalysis[TblTable1[,i]==3,])<br />
   TblResults$n4<i>      &lt;- nrow(TblAnalysis[TblTable1[,i]==4,])<br />
   TblResults$n5<i>      &lt;- nrow(TblAnalysis[TblTable1[,i]==5,])<br />
   TblResults$Median<i>  &lt;- median(TblTable1[,i])<br />
   TblResults$Q25<i>     &lt;- quantile(TblTable1[,i],0.25)<br />
   TblResults$Q75<i>     &lt;- quantile(TblTable1[,i],0.75)<br />
   TblResults$IQRng<i>   &lt;- IQR(TblTable1[,i])<br />
   }<br />
                                  <br />
#Complete Results table<br />
TblResults<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
The data is coming from a table I set up earlier with this code:<br />
<br />
TblDB &lt;- sqlQuery(ADF2_ASTOnline,&quot;Select MotivPowder,MotivCrowds, MotivAdventure, MotivTerrain, MotivBored, MotivNotSupposed, MotivKicker, MotivExercise, MotivFriends, MotivNature, MotivImpress, MotivAbout, MotivLifeStyle, MotivDMSkill, MotivPictures, MotivIdentity  from tbl_analysis;&quot;)<br />
<br />
TblTable1 &lt;- na.omit(TblDB)<br />
<br />
<br />
<br />
<br />
<br />
<br />
Here is a header of the table to see what it looks like:<br />
<br />
&gt; head(TblTable1)<br />
  MotivPowder MotivCrowds MotivAdventure MotivTerrain MotivBored<br />
1           5           5              4            4          2<br />
2           5           2              4            5          2<br />
3           5           5              4            3          3<br />
4           5           5              3            2          1<br />
5           5           5              5            3          3<br />
6           5           4              3            3          1<br />
  MotivNotSupposed MotivKicker MotivExercise MotivFriends MotivNature<br />
1                1           1             3            3           2<br />
2                1           3             2            3           2<br />
3                2           4             2            3           2<br />
4                1           1             5            3           5<br />
5                1           1             3            3           5<br />
6                1           1             1            1           3<br />
  MotivImpress MotivAbout MotivLifeStyle MotivDMSkill MotivPictures<br />
1            1          4              3            3             4<br />
2            1          1              4            2             3<br />
3            1          1              2            2             1<br />
4            2          1              5            4             1<br />
5            1          1              3            3             2<br />
6            1          1              3            3             1<br />
  MotivIdentity<br />
1             3<br />
2             4<br />
3             4<br />
4             5<br />
5             3<br />
6             4</i></i></i></i></i></i></i></i></i></i>]]></description>
            <dc:creator>matosan</dc:creator>
            <category>R</category>
            <pubDate>Mon, 02 Mar 2009 21:52:13 -0800</pubDate>
        </item>
        <item>
            <guid>http://forums.stat.ucla.edu/read.php?3,7,7#msg-7</guid>
            <title>Adding matrices in an array (4 replies)</title>
            <link>http://forums.stat.ucla.edu/read.php?3,7,7#msg-7</link>
            <description><![CDATA[ I have a [nxpxq] array, I want to obtain a [nxp] matrix where each element of that matrix is the sum of the corresponding elements in the q matrixes in the array.<br />
<br />
A simple example is shown below:<br />
<br />
a is a [2x3x2] array.<br />
<br />
&gt; (a = array(c(1:12),c(2,3,2)))<br />
, , 1<br />
<br />
     [,1] [,2] [,3]<br />
[1,]    1    3    5<br />
[2,]    2    4    6<br />
<br />
, , 2<br />
<br />
     [,1] [,2] [,3]<br />
[1,]    7    9   11<br />
[2,]    8   10   12<br />
<br />
I want to obtain a 3rd matrix that is the sum of the these two matrices.<br />
<br />
&gt; a[,,1]+a[,,2]<br />
     [,1] [,2] [,3]<br />
[1,]    8   12   16<br />
[2,]   10   14   18<br />
<br />
This is easy by simple addition when there are only 2 matrices however I have 119 of these. I know it's possible to do this with a loop but I was wondering if there is another way of doing this without a loop.<br />
<br />
Thanks,<br />
Mine]]></description>
            <dc:creator>Mine Cetinkaya</dc:creator>
            <category>R</category>
            <pubDate>Tue, 03 Mar 2009 09:11:27 -0800</pubDate>
        </item>
        <item>
            <guid>http://forums.stat.ucla.edu/read.php?3,2,2#msg-2</guid>
            <title>First post (no replies)</title>
            <link>http://forums.stat.ucla.edu/read.php?3,2,2#msg-2</link>
            <description><![CDATA[ Welcome to SCC's R forum.  If you are subscribed to the feed or a moderator you should receive notice of this posting.]]></description>
            <dc:creator>Jose Hales-Garcia</dc:creator>
            <category>R</category>
            <pubDate>Mon, 02 Mar 2009 11:58:47 -0800</pubDate>
        </item>
    </channel>
</rss>
