Displaying 20 results from an estimated 300 matches similar to: "multiple tapply"
2010 Jun 09
4
question about "mean"
Hi there:
I have a question about generating mean value of a data.frame. Take
iris data for example, if I have a data.frame looking like the following:
---------------------
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4
0.2 setosa
2 4.9 3.0 1.4
0.2
2004 Aug 21
2
more on apply on data frame
Hi R People:
Several of you pointed out that using "tapply" on a data frame will work on
the iris data frame.
I'm still having a problem.
The iris data frame has 150 rows, 5 variables. The first 4 are numeric,
while the last is a factor, which has the Species names.
I can use tapply for 1 variable at a time:
>tapply(iris[,1],iris[,5],mean)
setosa versicolor virginica
2001 Feb 19
1
means by column after split
Colleagues
----------------------------------
System info:
R version rw1020 on NT
ESS using emacs ver. 20.4
----------------------------------
I need to get the means for each column of a dataframe in the list
created by splitting a data frame. At present, I am getting the mean of all
columns in aggregate.
The structure of the unsplit data is:
> shuttle.tr1[1:10,]
juliandate
2012 Jun 11
1
saving sublist lda object with save.image()
Greetings R experts,
I'm having some difficulty recovering lda objects that I've saved within sublists using the save.image() function. I am running a script that exports a variety of different information as a list, included within that list is an lda object. I then take that list and create a list of that with all the different replications I've run. Unfortunately I've been
2010 Jun 14
3
remove last char of a text string
Dear R experts,
is there a simple way to remove the last char of a text string?
substr() function use as parameter start end only... but my strings are of
different length...
01asap05a -> 01asap05
02ee04b -> 02ee04
Thank you all,
Gianandrea
--
View this message in context: http://r.789695.n4.nabble.com/remove-last-char-of-a-text-string-tp2254377p2254377.html
Sent from the R help mailing
2008 Oct 01
2
an unsophisticated question about recoding in a data frame with control structure if {}
Hello all,
I apologize for a terribly simple question. I'm used to using Stata and am trying to `switch' over to R.
I would like to recode a vector in a data frame when the value of it meets the following condition: if (dataframe$factor=='3'){dataframe$thevector<-(an arithmetic mean). What I would like to result is the creation of a new variable within the data frame for
2008 Aug 28
3
drop unused levels in sqldf
Hi,
sqldf is a fantastic package, but when the SELECT procedure runs unused
levels remain in the output. I tried with the drop function, but without
success. Do you have any suggestions?
Thanx, Gianandrea
data(iris)
require(sqldf)
base<-sqldf("select * from iris where Species <> 'setosa'")
str(base) # Species with 3 levels!
--
View this message in context:
2009 Feb 19
2
dotplot points color
Dear list,
is it possible to change the background color of dotplot's points? I tried
in many ways but unsuccessfully
Thanks in advance
Gianandrea
require(lattice)
dotplot(variety ~ yield | site, data = barley, groups = year, pch=21)
dotplot(variety ~ yield | site, data = barley, groups = year, pch=21,
bg=c("2","3")) ??!!!
--
View this message in context:
2010 Dec 15
3
Applying function to a TABLE and also "apply, tapply, sapply etc"
Dear R-help forum members,
Suppose I have a data-frame having two variables and single data for each of them, as described below.
variable_1 variable_2
10 20
I have written a function, say, 'fun' which uses input 10 and 20 and gives me desired result.
fun = function(X, Y)
{
X + Y #( I am just giving an example of
2009 Mar 03
1
Self-Organizing Map analysis
Dear list,
I read the SOM package manual but I don't understand how to perform (for
example) 1) the SOM analysis on Iris data 2) with a visualization similar to
that of figure 7 in
http://www.cis.hut.fi/projects/somtoolbox/package/papers/techrep.pdf
Any suggestion? Thanks in advance,
Gianandrea
--
View this message in context:
2008 Sep 23
1
plot error
HI there,
why these lines of code are correct
plot(count~spray, data = InsectSprays)
plot(InsectSprays$count)
but this return an error:
plot(count, data = InsectSprays);
"data" method is not implemented in plot?!
Thanx, Gianandrea
--
View this message in context: http://www.nabble.com/plot-error-tp19624873p19624873.html
Sent from the R help mailing list archive at Nabble.com.
2008 Sep 26
1
cca constraining variables table
I performed canonical correspondence analysis (cca) with the example data of
vegan, but I'm not able to obtain a table like scores() for the constraining
variables. I can see them in the summary() mode, but it would be great to
have in a separate table. Any suggestion?, thanx Gianandrea
require(vegan)
data(varespec)
data(varechem)
vare.cca<-cca(varespec,varechem)
scores(vare.cca)
2009 Jul 02
1
From xtabs to matrix
Hi list,
is it possible convert the xtabs result
xtabs(breaks~tension+wool,data=warpbreaks)
wool
tension A B
L 401 254
M 216 259
H 221 169
to a simple matrix or data frame?
A B
L 401 254
M 216 259
H 221 169
Thanks a lot! Gianandrea
--
View this message in context: http://www.nabble.com/From-xtabs-to-matrix-tp24304588p24304588.html
2007 Aug 01
1
New R package sqldf
sqldf is an R package for running SQL select
statements on one or more R data frames. It is
optimized for convenience making it useful
for ad hoc queries against R data frames.
Given an SQL select statement whose tables
are the names of R data frames it:
- sets up the database (by default it transparently
sets up an in memory SQLite database using RSQLite;
however, MySQL via RMySQL, can be
2007 Aug 01
1
New R package sqldf
sqldf is an R package for running SQL select
statements on one or more R data frames. It is
optimized for convenience making it useful
for ad hoc queries against R data frames.
Given an SQL select statement whose tables
are the names of R data frames it:
- sets up the database (by default it transparently
sets up an in memory SQLite database using RSQLite;
however, MySQL via RMySQL, can be
2010 Nov 03
2
bugs and misfeatures in polr(MASS).... fixed!
In polr.R the (several) functions gmin and fmin contain the code
> theta <- beta[pc + 1L:q]
> gamm <- c(-100, cumsum(c(theta[1L], exp(theta[-1L]))), 100)
That's bad. There's no reason to suppose beta[pc+1L] is larger than
-100 or that the cumulative sum is smaller than 100. For practical
datasets those assumptions are frequently violated, causing the
2018 Mar 23
2
aggregate() naming -- bug or feature
In the examples below, the first loses the name attached by foo(), the second retains names attached by bar(). Is this an intentional difference? I?d prefer that the names be retained in both cases.
foo <- function(x) { c(mean = base::mean(x)) }
bar <- function(x) { c(mean = base::mean(x), sd = stats::sd(x))}
aggregate(iris$Sepal.Length, by = list(iris$Species), FUN = foo)
#>
2005 Dec 31
2
Q about RSQLite
Happy new year, dear listers,
I have a question about Rsqlite.
when I fetch the data out of sqlite database, there is something like '\r\n'
at the end of last column. Here is the example:
Sepal_Length Sepal_Width Petal_Length Petal_Width Species
1 5.1 3.5 1.4 0.2 setosa\r\n
2 4.9 3.0 1.4 0.2 setosa\r\n
3
2018 Mar 23
1
aggregate() naming -- bug or feature
On Fri, Mar 23, 2018 at 6:43 PM, Rui Barradas <ruipbarradas at sapo.pt> wrote:
> Hello,
>
> Not exactly an answer but here it goes.
> If you use the formula interface the names will be retained.
Also if you pass named arguments:
aggregate(iris["Sepal.Length"], by = iris["Species"], FUN = foo)
# Species Sepal.Length
# 1 setosa 5.006
# 2
2018 May 31
2
mysterious rounding digits output
Well pointed out, Jim!
It is infortunate that the documentation for options(digits=...)
does not mention that these are *significant digits* and not
*decimal places* (which is what Joshua seems to want):
"?digits?: controls the number of digits to print when
printing numeric values."
On the face of it, printing the value "0,517" of 'ccc' looks
like printing 4