Displaying 7 results from an estimated 7 matches for "cbarnabi".
Did you mean:
cbarnaby
2008 May 05
4
Column renaming
Dear all,
Is there a less cumbersome way to rename a column by name (as opposed
to index) than --
names( X)[ names[ X] == "bob"]<-"sue"
?
A semi-related question: how does one get the index of a column by
name, something along the lines of col.index( X, "sue") ?
Chip Barnaby
---------------------------------------------------------
Chip Barnaby
2008 May 12
2
Collection of lm()s
Hello,
I would like to create a subscriptable collection (presumably a list)
of lm() models.
I have a data frame DX containing 6 groups of data. The general idea
is (NOT RUN) ...
for (i in 1:6)
{ DXS = subset( DX, <whatever>);
LMX[ i] = lm( <formula>, data = DXS);
}
Now access model results by subscript ... e.g. coefficients( LMX[
2]). Or would it be [[ 2]]?
I
2008 May 09
1
Data frame row manipulation
Greetings,
Q #1
------
How does one combine data frames by row ... no cleverness a la
merge(), just add rows.
For example, given A with 20 rows and B with 30 rows, I want C =
combine( A, B) having 50 rows.
Columns having matching names should be filled from both (all)
sources with suitable coercion, unmatched would get NA in rows whose
source does not have that column.
Q #2
------
Given
2008 Apr 30
1
Aggregate() questions
Dear all --
I have a data frame containing data related to heat gain through
windows. The general form is ...
Key ProfA IAC <many other numeric columns>
AAA 0 .7
AAA 10 .6
AAA 0 .66
AAA 20 .45
(more AAA rows)
(then AAB rows)
'Key' identifies the physical configuration ... rows with a given Key
contain data for same window under various
2008 May 28
1
Grouped weighted.mean
Dear all --
I want to compute weighted.mean() for grouped rows.
Data frame extract is just below. For each Key, I want the mean of
IAC weighted by Wt.
DP0[1:20,]
Key
IAC Wt
2 C3-PD030020050.PD030020050.3.12.3.0 0.765 0.8590000
3 C3-PD030020050.PD030020050.3.12.3.0 0.764 0.8449651
4 C3-PD030020050.PD030020050.3.12.3.0
2008 May 30
1
Aggregation and the meaning of class
Dear R-ers,
My aggregation saga continues.
Using the following sequence, I can calculate any statistic for row
groups and merge the result back to all associated rows ...
> WM = by( D60, D60[ "KeyProfA"], FUN=function(x) weighted.mean( x$IAC, x$Wt))
> D60$IAC.WM = as.numeric( WM[ D60$KeyProfA])
> class( WM)
[1] "by"
Questions ...
1) Is this a reasonable way
2008 Apr 07
2
predict.lm() question
Dear R-people ...
I'm a new user. I can't get predict.lm() to produce predictions for
new independent data. There are some messages in archived help about
this problem, but I still don't see my error after reviewing
those. I understand that the new independent data must have the same
name(s) as used when the model was made.
In the example below, predict.lm produces the