Displaying 20 results from an estimated 2000 matches similar to: "count NAs with aggregate"
2009 Aug 06
1
Using 'field names' of a data.frame in a function
I may be doing this wrong! but I have a function which I have simplified a lot below. I want to pass some 'field names' of a data-frame to the function for it to then do some manipulation of.
Here's my code:
#build a simple dataset
mydataset = data.frame (
2007 Mar 03
2
format of summary.lm for 2-way ANOVA
Hi,
I am performing a two-way ANOVA (2 factors with 4 and 5 levels,
respectively). If I'm interpreting the output of summary correctly,
then the interaction between both factors is significant:
,----
| ## Two-way ANOVA with possible interaction:
| > model1 <- aov(log(y) ~ xForce*xVel, data=mydataset)
|
| > summary(model1)
| Df Sum Sq Mean Sq F value Pr(>F)
|
2013 Jul 12
2
vegan capscale 'subscript out of bounds' error
Hi list,
I am using the capscale function in vegan_2.0-7 to do a constrained
principal coordinates analysis, and I kept getting the following error
message:
Error in Y.r[, oo, drop = FALSE] : subscript out of bounds
I googled but I couldn't find an answer. Could anyone tell me why this
error msg and what to do?
Here is the command I used:
2007 Jul 26
1
significance test for difference of two correlations
Dear R users,
how can I test, whether two correlations differ significantly. (I want to prove, that variables are correlated differently, depending on the group a person is in.)
Greetings from Freiburg im Breisgau (Germany),
Timo Stolz
2008 Aug 19
2
how to import from SPSS without shortening variable names
Hello,
as I import '.sav' files from SPSS, the variable names are shortened to
8 uppercase characters:
"sex_of_therapist" will become "SEX_OF_TH"
Is there a way around this? How can I retrieve the full names?
Greets from Southern Germany,
Timo Stolz
2012 May 16
2
replacing with NA
Dear R users,
I was wondering how I can replace the values of a vector with the values from in another vector in the same row
For example, how can I replace the value of x below with NA when the value of Z in the same row is NA?
x <-1:20
z<- c(11, 15, 17, 2, 18, 6, 7, NA, 12, 10,21, 25, 27, 12, 28, 16,17, NA, 12, 10)
Many thanks
Mintewab
________________________________________
Fr?n:
2013 Apr 14
1
Aggregate function Bagging
Good morning all.
I am doing bagging with package caret. I need bagging for a classification
problem. I am working with " bag".
bag(x, y, B = 10, vars = NULL, bagControl = bagControl(), ...)
bagControl(fit = NULL,
predict = NULL,
aggregate = NULL,
downSample = FALSE)
My fit function is:
svmFit <- function(x, y, ...)
{
library(e1071)
2010 Jul 29
2
ggplot2 histograms... a subtle error found
Hello all,
I have a peculiar and particular bug that I stumbled across with
ggplot2. I cannot seem to replicate it with anything other than my specific
data set.
Here is the problem:
- when I try to plot a histogram, allowing for ggplot2 to decide the
binwidths itself, I get the following error:
- stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to
2012 Jul 05
4
Exclude missing values on only 1 variable
Hello,
I have many hundred variables in my longitudinal dataset and lots of
missings. In order to plot data I need to remove missings.
If I do
> data <- na.omit(data)
that will reduce my dataset to 2% of its original size ;)
So I only need to listwise delete missings on 3 variables (the ones I am
plotting).
data$variable1 <-na.omit(data$variable1)
does not work.
Thank you
2002 Dec 10
1
lattice barchart with "negative" bars
Dear all,
I'm trying to use the lattice barchart function to obtain a bar plot of a
variable for different values of two factors. The thing I'm trying to do is
something like this:
> barchart(MyVar ~ season | place, data=mydataset)
My problem is that the column MyVar has some negative values and I would like
them to be represented as bars stacking down from zero instead of what
2004 Jul 30
1
optimisation procedure with flat log-likelihood
Dear R-friends,
I use
optim(par=c(mystartingpoints), fn=myloglikelihoodfunction, gr=NULL,
method=c("L-BFGS-B"), ## I would like to do not use any
bounds
control=list(trace=6, ## just to see what it's going on
maxit=c(20000)), ## to be sure the it
doesn't stop reaching the max iterations
2006 May 10
1
identify high dimension data point
Hi there,
I am having some trouble with the Identify() function, it looks that the identify() function only works on the plot of 2-dimension data set. In high-dimension case , if I use pairs() + identify() in hope to observe all the components of the data point I selected, I get error message. Is there anyway to get around this ? Plus, I also need it to actually compare all the
2009 Apr 02
1
Start Klimt from R
Hello,
I want to start Klimt from S.Urbanek directly from R.
In the description of klimt is the following R-Code:
source("klimt.r");
d<-read.table("mydataset.txt");
t<-tree(OUT2~.,d);
Klimt(t,d);
One should make sure, that the klimt.jar is in the working directory of R
(in my case "C:\Program FilesR\R-2.8.1" I think).
But although I copied klimt.jar into
2009 Jul 28
5
Summarising Data for Forrest Plots
I tried to post this a few times last week and it seems to have got stuck somehow so I'm trying from a different email in the hope that works. If somehow this has appeared on the list 20 tiems and I never saw any of them I apologize ;-)
I'm basically an R-newbie. But I am VERY computer literate. But this has me stumped...
All the examples for using the rmeta package to create a
2024 Jan 30
1
R interpreting numeric field as a boolean field
Hi Bert,
Below the information you asked me for:
nrow(mydataset)
[1] 2986276
########
sapply(mydataset, "class")
$`Transit Date`
[1] "POSIXct" "POSIXt"
$`Market Segment`
[1] "character"
$`N?mero de Tr?nsitos`
[1] "numeric"
$`Tar No`
[1] "character"
$`Beam Range (Operations)`
[1] "character"
$`Operational Vessel Ranges
2011 May 19
2
trouble with summary tables with several variables using aggregate function
Dear all,
I am having trouble creating summary tables using aggregate function.
given the following table:
Var1 Var2 Var3 dummy
S1 T1 I 1
S1 T1 I 1
S1 T1 D 1
S1 T1 D 1
S1 T2 I 1
S1 T2 I 1
S1 T2 D 1
S1 T2 D 1
S2
2010 Feb 17
2
Is the aggregate function the best way to do this?
Hi,
I''m having a dataframe ''Subset1'' with a number of factor variables and 160
numerical variables
Now I want to make sums for all rows that have the same values for the
different factor variables, except for the factor variables: VAR1,VAR2,VAR3
who may have the same values.
With the formula given below this works great, but in a situation with 15000
rows and 13
2003 Jun 14
1
Missing data augmentation
Hi all,
A short while ago I asked a question about multiple imputation and I
got several helpful replies, thanks! I have untill now tried to use the
packages mice and norm but both give me errors however.
mice does not even run to start with and gives me the following error
right away:
iter imp variable
1 1 Liquidity.ratioError in chol((v + t(v))/2) : the leading minor
of order 1 is not
2006 Feb 11
2
aggregate vs tapply; is there a middle ground?
Dear all,
I'm wanting to do a series of comparisons among 4 categorical variables:
a <- aggregate(y, list(var1, var2, var3, var4), sum)
This gets me a very nice 2-dimensional data frame with one column per
variable, BUT, as help for aggregate says, <<empty subsets are
removed>>. I don't see in help(aggregate) how I can change this.
In contrast,
a <- tapply(y,
2011 Jul 14
2
cbind in aggregate formula - based on an existing object (vector)
Hello!
I am aggregating using a formula in aggregate - of the type:
aggregate(cbind(var1,var2,var3)~factor1+factor2,sum,data=mydata)
However, I actually have an object (vector of my variables to be aggregated):
myvars<-c("var1","var2","var3")
I'd like my aggregate formula (its "cbind" part) to be able to use my
"myvars" object. Is it