Displaying 20 results from an estimated 110 matches similar to: "Using weighted.mean() in aggregate()"
2007 Dec 17
2
more structure than 'str'?
How can I see more of the structure than displayed by 'str'?
Consider the following:
tstDF <- data.frame(a=1, row.names='b')
> str(tstDF)
'data.frame': 1 obs. of 1 variable:
$ a: num 1
The object 'tstDF' has row.names, but I have to suspect they are
there -- AND know a function like 'row.names' or 'dimnames' -- to see
2004 Dec 04
1
AIC, AICc, and K
How can I extract K (number of parameters) from an AIC calculation, both to
report K itself and to calculate AICc? I'm aware of the conversion from AIC ->
AICc, where AICc = AIC + 2K(K+1)/(n-K-1), but not sure of how K is calculated
or how to extract that value from either an AIC or logLik calculation.
This is probably more of a basic statistics question than an R question, but I
thank
2005 Oct 12
2
functions available for use with aggregate?
What are the functions available for use with “aggregate”? Where can a reference to them be found?
---------------------------------
[[alternative HTML version deleted]]
2011 Mar 11
1
Error in plot.lm
I am encountering an error with plot.lm:
> tstdf <- data.frame( y=c(1.01,1.98,3.02,3.99),x=c(1,2,3,4))
> plot(lm(I(y) ~ x, data=tstdf))
Hit <Return> to see next plot:
Hit <Return> to see next plot:
Error in object$coefficients : $ operator is invalid for atomic vectors
Obviously I don't need the I() in this example, but I have been working
with regressions that involve
2005 Jun 17
3
Fit values for NA's in linear regression
Hi,
To obtain estimates for some missing values in my data I fitted a
linear regression and then used the command fitted(model) to get the
fitted values from the model, but R doesn't return any values for the
NA's. I can calculate the fitted values from the estimates obtained
from the summary of model, but that's not very handy. Is there a way to
include the missing values in the
2003 Aug 14
2
nls confidence intervals
Hi,
Does anyone know how to compute the confidence prediction intervals for
a nonlinear least squares models (nls)?
I was trying to use the function 'predict' as I usually do for other
models fitting (glm, lm, gams...), but it seems that se.fit, and
interval computation is not implemented for the nls...
Cheers
Enrique
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fisheries Research Services,
Marine
2005 Jul 15
1
2D contour predictions
Hi All
I have been fitting regression models and would now like to produce some
contour & image plots from the predictors.
Is there an easy way to do this? My current (newbie) experience with R
would suggest there is but that it's not always easy to find it!
f3 <- lm( fc ~ poly( speed, 2 ) + poly( torque, 2 ) + poly( sonl, 2 ) +
poly( p_rail, 2 ) + poly( pil_sep, 2 ) + poly( maf, 2
2011 Jul 09
2
Meta-analysis with zero values for mean and sd. Continuous data.
Hi,
I want to do a meta-analysis with count data for treatement/control cases.
Mi problem is that I need to use zero values (an informative zero value) for
the mean and standard deviation for one of the treatement, but R has a
problem: "Studies with zero values for sd.e or sd.c get no weight in
meta-analysis". I can agroup the case by Family (byvar=Family).
¿Can you help me? Thanks!
2005 Apr 30
1
legend(): how to put variable in subscript?
Dear List,
I would like to plot a simple legend with two math expressions, e.g.
plot(0)
legend(1, 0.5, expression(sigma[i], sigma[j]))
The difficulty is that i and j should be variables rather than strings "i" and
"j". In other words I'd like to do something like:
i = "A"
j = "B"
legend(1, 0.5, expression(sigma[i], sigma[j]))
and have "A"
2003 Nov 11
2
Test for new page
Dear R experts,
I am writing a multi-page PDF file and would like to put a header on each
page. Is there a way to test a graphic device to see if a new page is started
(so that I know when to write the header)?
I could simply count the plots made (each page has the same number of plots),
but wanted to see if a more general solution is available.
Thank you,
Aleksey
--
Aleksey Naumov
GIS
2010 Nov 16
4
Simple error handling in R
Hi R experts,
I am looking for a simple error handling approach, whereby I could stop
function execution with a customized error message. For example:
for (i in 1:10) {
if (i == 5)
# I'd like to be able to stop right here with an error message I have
complete control over
}
The problem with stop() is that I cannot control completely what gets
printed to the terminal, even with
2000 Mar 26
2
hist2d() function in R?
Dear R users,
I am just starting with R (v. 1.0.0) and I use Vehables & Ripley's
MASS book for examples.
In the intro session, there is an example of a 2D histogram on an 8x8
grid:
x <- rnorm(1000)
y <- rnorm(1000)
contour(hist2d(x,y,,,8,8))
R complains:
Error in contour(hist2d(x, y, , , 8, 8)) :
couldn't find function "hist2d"
I looked for hist2d() in the
2002 Oct 26
3
Using the Search Engine & Keywords
Dear R experts,
Can anyone running R on Linux share how they use the "Search Engine &
Keywords" page of R documentation? I cannot do any javascript on this page,
either searching for a term or following the keyword links. I tried Konqueror
(3.0.4, with javascript globally enabled), Mozilla (1.1), and Galeon (1.2.5),
but none of them do anything...
Sorry, I don't know
2000 Jun 13
3
Question on closure (lexical scoping) and encapsulation
Dear R users,
I have two related questions about scoping and data encapsulation.
One is fairly specific - I am looking at "scoping.R" which is used in
demo(scoping) - it's an example of lexical scoping and encapsulation.
Where is the 'total' stored? It is not an attribute in 'ross' or
'robert'
however, functions like balance() have access to it.
Is it more
2000 Oct 10
1
Adding a new column to data frame (recoding)
Dear R users,
I have a very simple question. What is the easiest way to recode data in
one
of the columns of a data frame and put it into a new column?
For example, here is a simple data frame:
var1
1 1
2 2
3 3
How do I add a new column to data - 'var2' in which I group values in
'var1',
for example:
var1 var2
1 1 4
2 2 4
3 3 5
It's got to
2017 Jun 29
1
NUT supporting Modbus TCP
Yeah, I have its datasheet (it's a Xantrex XW invertor by the way). I do not know why creating a more-or-less generic driver is an issue. Of course, there are Modbus beasts that can scare everyone but mostly one would need to read either intreger or float numbers out of Modbus registers in order to decide whether or not to start or stop the shutdown process.
24 ???? 2017 ?. 19:25:14
2017 Jun 24
2
NUT supporting Modbus TCP
Hi!
I was wonering if there is a driver that supports communicating with a Modbus
aware device over IP. I have a solar/wind invertor that can broadcast its state
and I would like to monitor the batteries. If they discarge to a certain voltage
or come to a defined state, I would perform a shutdown. All of this information
id provided in Modbus holding registers. This could of course be done
2000 Nov 17
2
Randomly selecting n (unique) elements out of vector of length m...
Dear R users,
I wonder if there is a simple way to select a random and non-overlapping
subset of a vector?
Say, I need to randomly select 10 out of 100 numbers in a vector V. By
"non-overlapping" I
mean that a number in any position in V (V[1]...V[100]) should be
selected at most once
(i.e. selection without recycling).
I could simplu use a uniform distribution to generate selection
2000 Dec 14
1
How do I track a segfault?
Dear R users,
I have to catch a nasty bug and would appreciate any advice or help!
I get a segfault (core dumped) that happens in one of my own functions.
The problem is, it
does not happen most of the time, only sometimes, so it's very hard to
reproduce. Or it may
run ok in interactive mode, but bug out in batch mode. Also, it tends to
happen more on
the slower of my 2 machines (PII 266),
2010 Mar 05
2
Sweave and optional document sections
Dear R and Sweave users,
Is there a way to have optional sections in a Sweave-generated report
document, complete with section header(s), text and code chunks? In other
words, I'd like for my report to include or omit certain sections based on
the data itself.
For example, If I examine the input dataset early on in the report and set a
variable has_daily_data = TRUE, then I'd like to