Hello everyone,
I have tried several ways of doing this and searched the documentation and
help lists and I have been unable to find an answer or even whether it is
possible to do it. I am pasting together a formula and I need to insert
double quotes around the strings. Here's an example:
+s789695n457488...@n4.nabble.com
To: ritacarre...@hotmail.com
Subject: Re: pasting a formula string with double quotes in it
Hello,
StellathePug wrote
Hello everyone,
I have tried several ways of doing this and searched the documentation
and help lists and I have been unable to find
Dear R Users,
I have looked for a solution to the following problem and I have not been
able to find it on the archive, through Google or in the R documentation.
I have a data frame, say df, which has 4 variables, one of which I would
like to use as a grouping variable (g), another one that I
Thanks Jean, that worked perfectly!
Try this
sapply(split(df, df$g), function(x) apply(x[, 1:2], 2, weighted.mean,
x$w))
Jean
StellathePug wrote on 09/21/2011 01:15:33 PM:
I have a data frame, say df, which has 4 variables, one of which I would
like to use as a grouping variable (g
Thank you Dan and Ista!
Both of you are correct, I should have used NA rather than NA in my
example. So the correct code should be:
X -as.data.frame(matrix(c(9, 6, 1, 3, 9, NA, NA,NA,NA,NA,
6, 4, 3,NA, NA, NA, 5, 4, 1, 3), ncol=2))
names(X)-c(X1,X2)
Hello everyone,
I am trying to figure out a way of replacing missing observations in one of
the variables of a data frame by values of another variable. For example,
assume my data is X
X -as.data.frame(matrix(c(9, 6, 1, 3, 9, NA, NA,NA,NA,NA,
6, 4, 3,NA, NA, NA, 5, 4, 1, 3),
Greetings R Users,
I have a system of equations for which I would like to output all the
R-squares. Assume there are four equations in my system, the only way I
found to output all the R-squares is by calling them out one by one as this:
summary(fitSUR$eq[[1]])$r.squared
sapply(fitSUR$eq, function(x) summary(x)$r.squared)
You can abbreviate that to:
sapply(summary(fitSUR)$eq, [[, r.squared)
This is fantastic! Thanks so much.
I had a hunch that it would be something related to the apply family but I
am still not very good at using it. Thank you immensely for
for (i in 1:(dat[(unique(dat$Subject)),)]
I don't think the order of the parentheses when you open the loop is
correct. You have four (s and only three )s. Plus the brackets (square
parentheses) seem so be out of order too.
If you use RStudio to write your code, when you highlight a
Hello R Users!
I have a list called tabs that I would like to have the same structure as
my list eqSystem. The two look like they have the same structure but they
are different because when I look at their attributes, class(eqSystem[[1]])
is call but class(tabs[[1]]) is formula. I want to have
I have taught myself R over the last few months and I learned quite a bit
from reading the PDFs that accompany each package, articles on the R Journal
(http://journal.r-project.org/) that cover similar problems to mine, and by
asking specific questions about code to this list. I also search online
11 matches
Mail list logo