search for: bernarduse1

Displaying 20 results from an estimated 34 matches for "bernarduse1".

2005 Sep 08
5
data manipulation
Dear All, I would be grateful if you can help me. My problem is the following: I have a data set like: ID time X1 X2 1 1 x111 x211 1 2 x112 x212 2 1 x121 x221 2 2 x122 x222 2 3 x123 x223 where X1 and X2 are 2 covariates and "time" is the time of observation and ID indicates the
2005 Nov 10
3
Remove levels
Daer All, I have a factor variable, X with 5 levels. When I type tables(X) it gives me: table(X) 1 2 3 4 5 10 5 0 0 0 How to drop the levels with zeros such that when I will type: table(X) it will give me: table(X) 1 2 10 5 Thank a lot, Bernard --------------------------------- [[alternative HTML version deleted]]
2005 Sep 16
3
Replicate
Dear All, I have a vector x = (1,1,1,2,2,2,3,3,3,3) I am looking for a function to return a vector containing the distinct elements of x i,e y = (1,2,3) The following code gives the desired results: as.numeric(levels(as.factor(x))) Is there any other elegant way? Thanks, B --------------------------------- [[alternative HTML version deleted]]
2008 Jan 30
4
boxplot and number of observations per box
Dear all, How can I plot the number of observations per box in a boxplot. Many thanks, Bernard --------------------------------- [[alternative HTML version deleted]]
2005 Oct 06
3
Singular matrix
Dear All, I have written the following programs to find a non-singular (10*10) covariance matrix. Here is the program: nitems <- 10 x <- array(rnorm(5*nitems,3,3), c(5,nitems)) sigma <- t(x)%*%x inverse <- try(solve(sigma), TRUE) while(inherits(inverse, "try-error")) { x <- array(rnorm(5*nitems,3,3), c(5,nitems)) sigma <- t(x)%*%x inverse <-
2005 Dec 20
2
Time data
Dear All, I wonder how to compute the age from the date of birth and the date of examination. Suppose that have the following data: df <- as.data.frame(rbind(c(1,"10/08/1950","15/03/1998"), c(1,"10/08/1950","20/07/1998"), c(1,"10/08/1950","23/10/1998"))) names(df) <- c("ID", "date_birth",
2007 Nov 19
4
sequence of vectors
Dear All, I wonder if there is any R function to generate a sequence of vectors from existing ones. For example: x 1<- c(1,2,3) x2 <- c(4,5) x3 <- c(6,7,8) The desired output is a list of all 3*2*3 = 18 possible combinations of elements of x1,x2 and x3. One element for example is (1,4,6). Many thanks in advance, Bernard
2005 Sep 11
1
Create New variable
Dear All, I want to create one numeric variable from a factor one. here is a simple example: x1 x2 factor x11 x21 f1 x12 x22 f1 x13 x23 f2 x14 x24 f3 . . . . . . Suppose that the variable factor has 3 levels (f1,f2,f3). I want to add to this data frame a numeric variable x4 in (v1,v2,v3) such that x4=v1 if factor = f1, x4 = v2 if
2005 Sep 21
1
Identical data frames
Dear All, Is there any R function to test if two data frames, say df1 and df2, having the same row names and the same column names are identiques? Thanks in advance, Bernard --------------------------------- [[alternative HTML version deleted]]
2006 Feb 02
2
re-coding variables
Dear All, I wonder how to re-code a categorical variable without using the ifelse loops. For example: Let X be a categorical variable with 6 levels, levels(X) = c(1,2,3,4,5,6) How to create a new categorical variable Y with levels, 10,11,12, say , such that: Y = 10 if X =1 or X=2 Y = 11 if X =3 or 4 Y =11 if X = 5 or 6 many thanks, Bernard
2006 Feb 21
3
Compute a correlation matrix from an existing covariance matrix
Dear All, I am wondering if there is an R function to convert a covariance matrix to a correlation matrix. I have a covariance matrix sigma and I want to compute the corresponding correlation matrix R from sigma. Thank you very much, Bernard --------------------------------- [[alternative HTML version deleted]]
2006 Jun 08
1
panel.abline and xyplot
Dear All, I am wondering on how to use the abline.xyplot with xyplot such that I will have different vertical lines for each panel. More sepcifically, suppose that the xyplot generates 4 panels defined by the combination of two binary variables: X_1 and X_2. i.e. xyplot(Y ~ Z | X_1*X_2, data = df) I want something like: abline(v = 5) if X_1=0 and X_2 = 0 abline(v =
2006 Jun 29
1
specify y axis values
Dear All, I am looking how to specify the values on the y axis and x axis for a curve function. example: curve(2*x + 3, 0,10) gives me a range of x axis in (0,2,4,6,8,10) amd for yaxis (5,10,15,20). How to do in order to have the x axis in (0,1,2,3,4,5,6,7,8,9,10) and y axis in (5,6,7,8,......, 10). Thanks a lot, Bernard ---------------------------------
2007 Feb 07
3
generate Binomial (not Binary) data
Dear All, I am looking for an R function or any other reference to generate a series of correlated Binomial (not a Bernoulli) data. The "bindata" library can do this for the binary not the binomial case. Thank you, Bernard --------------------------------- [[alternative HTML version deleted]]
2006 Mar 09
1
Suppress legend in plotting groupedData
Dear All, I would be grateful if you can tell how can I suppress the legend (automatically created) when I plot a groupedData. suppose that I have data farme df_0 which contains the following columns: ID represents the clusters, t represents time of observation, Y: the variable of interest and X a binary covariate. Then: df_1 <- groupedData(Y ~ t | ID) plot(df_1,
2007 Apr 27
1
bootstrap
Dear All, I would like to use a nonparametric bootstrap to calculate the confidence intervals for the 5% and 95% quantiles using boot.ci. As you know, boot.ci requires the use of boot to generate bootstrap replicates for my statistic. However this last function doesn't work in my case because I am missing something. Here is an example y <- rnorm(100) Quantile <-
2005 Sep 21
3
Sort a data frame with respect to more than one variable
Dear All, How can I sort a data frame with respect to more than one variable? I know that for one variable X one may use: df[order(df$X), ] where df is the data frame containing X. Many thanks, Bernard --------------------------------- [[alternative HTML version deleted]]
2006 Jun 23
7
PowerPoint
Dear All, I am looking for the best way to use graphs from R (like xyplot, curve ...) for a presentation with powerpoint. I used to save my plot as pdf and after to copy them as image in powerpoint but the quality is not optimal by so doing. Another completely independent question is the following: when I use "main" in the xyplot, the main title is very close to my plot,
2007 Nov 23
0
R users in Cyprus
...online help file. -- Mike Prager, NOAA, Beaufort, NC * Opinions expressed are personal and not represented otherwise. * Any use of tradenames does not constitute a NOAA endorsement. ------------------------------ Message: 52 Date: Wed, 21 Nov 2007 18:16:46 +0100 (CET) From: Marc Bernard <bernarduse1 at yahoo.fr> Subject: [R] Choosing the right model To: r-help at stat.math.ethz.ch Message-ID: <638001.73786.qm at web23409.mail.ird.yahoo.com> Content-Type: text/plain Dear All, Sorry if this question may not be appropriate to this list. I have the following question about the signific...
2006 Jun 15
1
xyplot problem
Dear all, I have created the following data (that you can run) in order to explain my problem: y <- rep(c(1,2), 8) id <- rep(1:8,each=2) x1 <- rep(c("-a","+a"), each = 8) x2 <- rep(c("-b","+b"), each = 2, times = 4) x3 <- rep(c("-c", "+c"), each = 4,2) df <- data.frame(cbind(id,y,x1,x2,x3)) If I do: