Hi
see in line
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Kristi Glover
Sent: Friday, March 28, 2014 7:04 PM
To: R-help
Subject: [R] starta.sampling with many (1000 times) and average them
Hi R Users,
I was trying to
Hi
create index variable in your data e.g.
Model.Update$idx - rep(1:n, each=5)
or
Model.Update$idx - c(0,1:nrow(Model.Update)%/%5)
After that you can use aggregate or by with elaborated function, something like
fn - function(dat) {
fit - lm(y ~ x + z, data=dat)
result - predict(fit)
}
or
El día 30/03/2014 a las 15:23, Si Qi L. liusiqi.n...@gmail.com
escribió:
Hi
I have a problem with linear regression. This is my codes:
acc1‑ lm(data$acc ~ dummy + data$Reqloanamount + data$Code +
data$Code.1 +
data$EmpNetMonthlyPay + data$Customer_Age + data$RTI)
summary(acc1)
I don't think cov.wt uses frequency weights. However, I don't think this is
mentioned in its help page.
Here is some information about the difference:
http://stats.stackexchange.com/questions/61225/correct-equation-for-weighted-unbiased-sample-covariance
The frequency version isn't hard to
On 31 Mar 2014, at 00:30 , Emilio Torres Manzanera tor...@uniovi.es wrote:
Dear Sir,
I am not sure about the precision of the cov.wt function. It seems that it
provides different results when using frequency weights. This discrepancy
only occurs with the covariance matrix, not with the
hello,
It's also possible to use the quantile function :
vec0 - c(0.1,0.2, 0.5, 0.1,0.8, 0.4, 0.9)
which(vec0 = quantile(vec0, 0.7, type = 1))
SD
2014-03-29 18:02 GMT+01:00 arun smartpink...@yahoo.com:
Hi,
Try:
vec1 - setNames(c(0.1,0.2, 0.5, 0.1,0.8, 0.4, 0.9), 1:7)
vec2 -
Hi,
I am very new on R so I will remember to post in plain text next time.
Thank you all for your help. I think I can figure it out now~ Many thanks!:)
Best regards,
Siqi
2014-03-31 11:43 GMT+01:00 Helios de Rosario helios.derosa...@ibv.upv.es:
El día 30/03/2014 a las 15:23, Si Qi L.
Hello,
I have difficulties to understand this one:
foo - function (y = 2) {
bar - function (y = y) y^2
bar()
}
foo()
#! Error in y^2 : 'y' is missing
foo(3)
#! Error in y^2 : 'y' is missing
Note that this one works:
foo - function (y = 2) {
bar - function (y = y) y^2
bar(y) #
I've read ?plot, ?plot.default, and ?plot.window to learn how to change
the shape of the plot from a square to a rectangle. plot.window suggests
that the aspect (asp) parameter is appropriate but that associates the x
axis size to the value of the y axis and, plot.window suggests that it is
On 31/03/2014 10:40 AM, Philippe Grosjean wrote:
Hello,
I have difficulties to understand this one:
foo - function (y = 2) {
bar - function (y = y) y^2
bar()
}
foo()
#! Error in y^2 : 'y' is missing
foo(3)
#! Error in y^2 : 'y' is missing
This is simply a misunderstanding about
Compiled code gives a better error message (not clear why the
interpreter doesn't do this as well):
cmpfun(foo)()
Error in bar() :
promise already under evaluation: recursive default argument reference or ear$
The environment in which default arguments are evaluated is the
environment of the
Note that the fact that bar() is defined within foo() is irrelevant.
## At the top level/global prompt:
y - 2
bar- function(y=y)y^2
bar()
Error in y^2 : 'y' is missing
## but
bar(y)
[1] 4
This is due to lazy evaluation and promises: The formal argument y
is not evaluated until it's used
On Mon, 31 Mar 2014, Rich Shepard wrote:
I've read ?plot, ?plot.default, and ?plot.window to learn how to change
the shape of the plot from a square to a rectangle. plot.window suggests
that the aspect (asp) parameter is appropriate but that associates the x
axis size to the value of the y
Dear useRs,
I have the data of following format. I have only pasted some part of the data.
The data starts from 1961 and ends up in december 1987.
dat - read.table(text=Date A B C D1-Jan-61 0.00 1.27 8.128 0.252-Jan-61 6.10
9.144 94.742 15.493-Jan-61 0.00 0.508 1.27 0.004-Jan-61 0.00 0 NA
Hello,
Maybe the following will do.
library(zoo)
ym - as.yearmon(dat$Date, %d-%B-%y)
aggregate(dat[,-1], list(ym), FUN = sum, na.rm = TRUE)
Also, please use dput() to post data examples.
Hope this helps,
Rui Barradas
Em 31-03-2014 18:31, eliza botto escreveu:
Dear useRs,
I have the data
Thanks AK.
Great job. I appreciate your effort.
Atem.
On Monday, March 31, 2014 11:28 AM, arun smartpink...@yahoo.com wrote:
Hi,
replace `lst2` with:
#Subset of data
lst1Sub - lapply(lst1Not1970,function(x) x[c(1:25, 18707:18708)])
lst2 - lapply(lst1Sub,function(x) {dateSite -
On Mon, 31 Mar 2014, Rich Shepard wrote:
What do I do to retain the specified width and height in the pdf output?
Use the height and width options to pdf(). Thanks to Don McQueen for
pointing me to the solution.
Rich
__
R-help@r-project.org
Dear useRs,
Sorry for such a ridiculous question but i really need to know that what is the
difference between NA and NA and how to convert NA to NA.
Thankyou very much in advance
Eliza
[[alternative HTML version deleted]]
Dear Rui,
Thanks for your reply. But the command seems not to be working. I am getting
the following error.
Error in FUN(X[[1L]], ...) : invalid 'type' (character) of argument
Any idea? :(
Thanks,
Eliza
Date: Mon, 31 Mar 2014 18:48:08 +0100
From: ruipbarra...@sapo.pt
To:
On Mar 31, 2014, at 1:29 PM, eliza botto eliza_bo...@hotmail.com wrote:
Dear useRs,
Sorry for such a ridiculous question but i really need to know that what is
the difference between NA and NA and how to convert NA to NA.
Thankyou very much in advance
Eliza
NA
On Mon, Mar 31, 2014 at 11:08 AM, Tierney, Luke luke-tier...@uiowa.edu wrote:
The environment in which default arguments are evaluated is the
environment of the function call itself, not the environment of the
caller or the lexical enclosure (the same here). So the two 'y' used
in function(y =
x - factor(c(whoops,NA,NA,B))
x
[1] whoops NA NA B
Levels: B NA whoops
is.na(x)
[1] FALSE FALSE TRUE FALSE
If this doesn't explain it for you, then read about missing values and
factors in An Introduction to R.
-- Bert
Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374
There are other issues here addressing the same question, but I don't
realize how to solve my problem based on it. So, I have 5 data frames that
I want to merge rows in one unique data frame using rbind, but it returns
the error:
Error in row.names-.data.frame(*tmp*, value = value) : 'row.names'
Hi,
replace `lst2` with:
#Subset of data
lst1Sub - lapply(lst1Not1970,function(x) x[c(1:25, 18707:18708)])
lst2 - lapply(lst1Sub,function(x) {dateSite - gsub((.*G.{3}).*,\\1,x);
dat1 - data.frame(Year=as.numeric(substr(dateSite,1,4)),
Hello,
Sorry, but I have no idea why the error message, with me it works
correctly. Are you sure that the four columns A, B, C and D are numeric?
What does str(dat) say?
Rui Barradas
Em 31-03-2014 19:40, eliza botto escreveu:
Dear Rui,
Thanks for your reply. But the command seems not to be
Converting data from a non-R format to R's internal format is a common
place to run into errors. Use the str() function to examine any data you
read in to make sure R is seeing it the way that you expect. If that looks ok
try using summary() or plot() for more checks that the data import went
Dear Rui,
Here is the complete data.
dput(dat)
structure(list(Date = c(1-Jan-61, 2-Jan-61, 3-Jan-61, 4-Jan-61,
5-Jan-61, 6-Jan-61, 7-Jan-61, 8-Jan-61, 9-Jan-61, 10-Jan-61,
11-Jan-61, 12-Jan-61, 13-Jan-61, 14-Jan-61, 15-Jan-61, 16-Jan-61,
17-Jan-61, 18-Jan-61, 19-Jan-61, 20-Jan-61, 21-Jan-61,
Hello,
You have several columns of class character that must be converted to
numeric before the code I previously posted can work:
dat[,-1] - lapply(dat[,-1], as.numeric)
Then use aggregate().
Rui Barradas
Em 31-03-2014 20:24, eliza botto escreveu:
Dear Rui,
I noticed that the previous
One more thing, as.yearmon considers dates such as 1-Jan-61 to be of
year 2061 when they may be of year 1961. There's no problem with that if
the only use for them is in aggregate().
Rui Barradas
Em 31-03-2014 21:22, Rui Barradas escreveu:
Hello,
You have several columns of class character
On 01/04/14 05:42, Jefferson Ferreira Ferreira wrote:
There are other issues here addressing the same question, but I don't
realize how to solve my problem based on it. So, I have 5 data frames that
I want to merge rows in one unique data frame using rbind, but it returns
the error:
Error in
I would like to share the answer I have received from Thomas Lumley
For models of the same size all those criteria reduce to picking the model with
the smallest residual sum of squares, which is what the code does.
-thomas
Thanks Bert and Dennis for the information but although it does not
How can I label existing axis tick marks with a
simple function of axis value like 1/AxisValue?
It seems like this should be an operation where
I just use the formula.
--
View this message in context:
On 04/01/2014 02:42 AM, Rich Shepard wrote:
On Mon, 31 Mar 2014, Rich Shepard wrote:
I've read ?plot, ?plot.default, and ?plot.window to learn how to change
the shape of the plot from a square to a rectangle. plot.window suggests
that the aspect (asp) parameter is appropriate but that
On 04/01/2014 09:25 AM, Hurr wrote:
How can I label existing axis tick marks with a
simple function of axis value like 1/AxisValue?
It seems like this should be an operation where
I just use the formula.
Hi Hurr,
You can do this with boxed.labels (plotrix) if you know the position of
the axis
Hi, I'm using a function in the binom library. I'd like to add a title(s) to
the plot generated by binom.bayes.densityplot.
I get an error message when trying to use the title function
The error message is: Error in title(main = my plot) : plot.new has not been
called yet occurs after running
Hello all,
A simple question. When I use grf from the package 'geoR' , I adopt the
exponential model. For this model is the parameter range in m or km?
Best
ioanna
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing
Hi,
I have some data from 1 year ago that is a measure of the number of days a
person used a certain product. I used fitdist to build a mle for this data
and got a pretty good fit.
My issue is that this data is outdated. I have new data from Januarry of
this year and would like to build a
Hello all,
A simple question. When I use grf from the package 'geoR' , I adopt the
exponential model. For this model is the parameter phi in m or km?
Best
ioanna
[[alternative HTML version deleted]]
__
R-help@r-project.org
Hi All,
I am trying to model a set of data that's a little bit complicated. Let's
say a person can live 365 more days from time t=0. I have data on 100
people, but I only know who died between day 0 and day 30. Everyone else
would've died between days 31 and day 365.
Is there any way to fit a
R 3.0.2
OS X
Colleagues
I am trying to label a graphic:
Cortisol (µg/ml)
A simplified version of the code is:
plot(1) ; mtext(bquote(Cortisol (~mu~g/ml)))
This code inserts spaces around the mu:
Cortisol ( µ g/ml)
How can I suppress those spaces?
Dennis
Dennis Fisher
Hi,
Try:
mtext(bquote(Cortisol~(mu*g/ml)))
A.K.
On Monday, March 31, 2014 10:05 PM, Dennis Fisher fis...@plessthan.com wrote:
R 3.0.2
OS X
Colleagues
I am trying to label a graphic:
Cortisol (µg/ml)
A simplified version of the code is:
plot(1) ; mtext(bquote(Cortisol (~mu~g/ml)))
Hi,
I am using ggplot and geom_violin to build a violin plot of some with only 2
categories. All is good except that I cannot set up the colors I want or the
violin plots. Either I have same color for both my categories or colors from
probably rainbow(2), which are red and blue. What if I
42 matches
Mail list logo