Displaying 20 results from an estimated 2000 matches similar to: "probability histogram question"
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,
2004 Aug 19
5
column names in data.frame
Dear R-help,
Please can someone explain how to put a column name on an output data.frame.
##Starting with a data.frame with 3 columns (d$Year, d$NoIndiv, d$wtd_tl)
yr_ind <- split (d$NoIndiv, d$Year)
yr_tl <- split (d$wtd_tl, d$Year)
ann_ind <- sapply (yr_ind, sum)
ann_tl <- sapply (yr_tl, sum)
av_tl <- ann_tl/ann_ind
d2<- data.frame (av_tl)
##This gives me a data.frame
2004 Jun 25
4
Unique.data.frame...still getting duplicates
Hi there
I have a data frame with about 65,000 rows and 8 variables. I am trying to
get rid of the double entries of a factor variable "ID" so I can get a
unique observation for each ID
I tried:
>dupl_unique.data.frame(data[ID,]) #I obtain a data frame with 21,547
>observations..so far so good, but then when I check for duplicates
>d_duplicated(dupl2$ID)
2004 Jul 08
4
read.frame
Hello group,
I am learning R and I am new to many concepts.I face
the following errors when I am trying to execute the
following. I have 4 text files with protein accession
numbers. I wanted to represent them in a venn diagram
and for that I using intersect and setdiff functions.
My data looks like this:
file1.txt (c):
NP_000005
NP_000020
NP_000030
NP_000053
file2.txt(e):
NP_000005
NP_000020
2006 Jan 06
1
Ordering boxplot factors
Hi all,
what a great help list! I hope someone can help me with this puzzle...
I'm trying to find a simple way to do:
boxplot(obs~factor)
so that the factors are ordered left-to-right along the x-axis by
median, not alphabetically by factor name.
Complicated ways abound, but I'm hoping for a magical one-liner that'll
do the trick.
Any suggestions would be treasured.
Thanks,
2006 Feb 26
1
changing degrees of freedom in summary.lm()
Hello all,
I'm trying to do a nested linear model with a dataset that incorporates
an observation for each of several classes within each of several plots.
I have 219 plots, and 17 classes within each plot.
data.frame has columns "plot","class","age","dep.var"
With lm(dep.var~class*age),
The summary(lm) function returns t-test and F-test values
2004 Sep 08
5
a little question about R
Hello,sir: Here's a little question about R which needs your help.Thanks in advance.
If I wanna make a sequence just like a,b,c,d (In other words,a vector consists of 4 characters :a,b,c,d ).How can I do it in a shortcut manner? Yes,I can do it as following: c("a","b","c","d") and the result is:[1] "a" "b" "c"
2004 Jul 08
7
Problem with the grep function
Let me present to you my problem :
I have a character vector x and I would like to obtain the indices of the
elements of
this vector that yielded exactly a match.
For example, x=nom, pattern="b", I would to obtain 2 because "b" is on the
second position.
First program :
nom <- c("a","b","ab")
grep("b",nom)
2 3
Then I try the
2002 Oct 28
1
as.POSIX (PR#2222)
Full_Name: Alec Stephenson
Version: 1.6.0
OS: linux
Submission from: (NULL) (148.88.138.5)
Appears to be a sign error in as.POSIX(lt/ct)
> library("chron")
The following is fine, with default origin.
> tmp <- chron(1:2, origin = c(1,1,1970))
> as.POSIXlt(tmp)
[1] "1970-01-02 01:00:00 GMT" "1970-01-03 01:00:00 GMT"
These are not.
> tmp <-
2003 Jul 28
2
defining and plotting functions thanks to equation
Hi R lovers!
Are there any means to define and plot a function given the equation that
specifies the function?
For example I'd like to plot and work with the Gumbel Distribution density
defined by
Lambda(x)=exp(-exp(-x))
My question may appear very simple but I haven't got an idea yet about how
to do that. I could plot something with x a vector/set of value but I don't
know how to
2002 Oct 29
1
documentation for require (PR#2226)
Full_Name: alec stephenson
Version: 1.6.0
OS: linux
Submission from: (NULL) (148.88.138.5)
The documentation for the function require is incorrect.
The file library.Rd has in its arguments section
\item{quietly}{a logical. If \code{TRUE}, a warning will not be
printed if the package cannot be found.}
which is incorrect, as a warning message is always given if the package
is not
2001 May 19
2
calculations on diagonals of a matrix
Given an nxm matrix A I want to compute the nxm matrix B whose ij-th
element is the sum of the elements of A lying on the diagonal that ends
with element ij, i.e.,
b_ij = a_ij + a_(i-1)(j-1) + a_(i-2)(j-2) + ...
In APL (which I no longer use), I would use the 'rotate' operator to derive
an array whose columns are diagonals of the given array and then cumulate
down columns. Is
2006 Dec 14
1
Fit Frechet Distribution
Hi everyone,
is there a function to fit a frechet distribution? The only thing I
found is gev.fit from ismev which fits a generalized extreme value
distribution (if shape>1 => Frechet) . Is there a function to only fit
a frechet?
Thank you
Benjamin
2004 Jul 26
3
Read SPSS data (*.sav) in R 1.8.0 (ok) and R1.9.1(error)
Hallo!
I read SPSS data in the following way:
library(Hmisc)
library(foreign)
dat<-spss.get("surv_abb.sav")
In R1.9.1 I got the message:
"Error in all(arg == choices) : Object "typeDate" not
found"
In R1.8.0 the same script works fine.
Does anybody know a possibilty to read a SPSS file
under R1.9.1?
Thanks!
Karl
2004 Jun 28
1
RMysql installation problem.
Hi!
I am trying to install the RMySQL package. The installation stops with the following error message.
path to mysql is set.
setenv PKG_CPPFLAGS /home/arabidopsis/software/R1.9.1/linux/mysql/include
setenv PKG_LIBS /home/arabidopsis/software/R1.9.1/linux/mysql/lib
R CMD INSTALL RMySQL_0.5-5.tar.gz
#....cut cut.
creating src/Makevars
** libs
gcc
2004 Oct 19
1
Fatal error: invalid home drive
Dear R-helpers,
I have just installed R2.0.0 onto my machine which already had R1.9.1
present.
I then tried to add to R2.0.0 a library called GLMM written by James McBroom
for R1.6.0. Unfortunately, R2.0.0 does not recognise the library, even
though
R1.9.1 does. This is not because I have used the wrong case in the call to
the
library:
> library('GLMM')
> "Error in
2004 Oct 06
4
R2.0.0 bug in function vcov in library survival (PR#7266)
Full_Name: Sven Sandin
Version: 2.0.0
OS: SuSE Linux 9.0
Submission from: (NULL) (81.227.17.135)
Have just compiled and installed R-2.0.0.tar.gz running SuSE9.0.
The function vcov do not accept "coxph" object as input any longer.
The same R-program running R1.9.1 do work. R-program attached below.
Exporting the coxph object from R2.0.0 to R1.9.1 I get vcov ouput in R1.9.1.
Exporting
2005 Feb 10
2
Mean calculated from R1.9.1 different from R2.0.1
Hello,
I ran my simulations on the Unix verson of R1.9.1 and the Windows version
of R2.0.1 on XP. I kept getting different values for the mean of the same
column of the same matrix, and am perplexed. I would appreciate if anyone
could help explain the difference?
Here is a sample code:
set.seed(7293)
z1v <- rnorm(1000, mean=68, sd=13)
z1v <- (z1v-mean(z1v))/sd(z1v)
Using R1.9.1 on Unix,
2006 Feb 12
0
SUMMARY: aggregate vs. tapply
Hi all;
Thanks for the responses to my query of how to make tapply into a table
instead of an n-dimensional array. Summary of responses follows:
Peter Dalgaard:
as.data.frame(with(tmp,as.table(tapply(C,list(A=A,B=B),sum))))
Phil Spector wrote:
z = tapply(y,list(var1,var2,var3,var4),sum)
data.frame(do.call('expand.grid',dimnames(z)),y=do.call('rbind',as.list(z)))
Hans
2004 Sep 30
3
Is there any way to release memory in running time?
Hi all,
I am doing some intensive computation right now. My system is Pentium4 3.20G
+ 1.0G RAM + WindowsXP + R1.9.1. It seems my computer is very powerful.
However, when I do some simple matrix algebra operations based on a matrix
(DD) with dimension 5000000 by 2, I found that the consumption of RAM is
huge. For example, the command a <- 1 - DD[,2] eats my 100M RAM. Does anyone
know how