[R] How to create multi variables

2014-05-13 Thread Yuanzhi Li
Hi, everyone I want to create a series of variables (e.g. t1, t2..., t10) which could be used in loops. My idea is to use function "assign" for (i in 1:10) { assign(paste("t",i,sep=""), FUN) # allocate the value from FUN to variable ti } But when I create a vector containing the names of

[R] regular pentagon

2014-03-07 Thread Yuanzhi Li
Hello, everyone, Do you have any idea to get a set of random points within a regular pentagon? Thanks in advance! Yuanzhi __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

[R] subset of data frame

2014-02-08 Thread Yuanzhi Li
Hi, everyone I met a small problem when I want take a subset from a data frame. The data frame(x) looks like the followings(10 species with 3 measured traits): Species trait1trait2 trait3 sp1 sp1 ... sp2 sp2 ... sp10 sp10 ... It would be easy if we want trait values for most abu

[R] subset of data frame

2014-02-08 Thread Yuanzhi Li
Hi, everyone I met a small problem when I want take a subset from a data frame. The data frame(x) looks like the followings(10 species with 3 measured traits): Species trait1trait2 trait3 sp1 sp1 ... sp2 sp2 ... sp10 sp10 ... It would be easy if we want trait values for most abu

[R] bargraph.CI

2013-12-11 Thread Yuanzhi Li
hello, I had a problem with the function "bargraph.CI". "bargraph.CI" draws a figure according to the alphabet sequence of the factor used. For example, I have a factor with for levels "CK", "N5", "N10", "N15", but the bars appear in "CK","N10","N15","N5" order(alphabet sequence), but I w

[R] volume of ellipsoid

2013-11-13 Thread Yuanzhi Li
Hi, everyone! I have a matrix X(n*p) which is n samples from a p-dimensional normal distribution. Now I want to make the ellipsoid containing (1-α)% of the probability in the distribution based on Mahalanobis distance: μ:(x-μ)'Σ^(-1)(x-μ)≤χ2p(α) where x and Σ is the mean and variance-covar