[R] is there any option like cex.axis in ggplot2?

2009-03-05 Thread Tom Cohen
Dear list,   I made boxplots using ggplot and want to control for x- and yaxis. Using "plot" I can do it by setting cex.axis equally to any size but can't figure out how to do it with ggplot.     ggplot(dat, aes(x = factor(time), y = volume)) + opts(axis.title.x=theme_text(size=8),axis.title.y=

[R] ggplot2: labels points with different colors or idnumbers

2009-02-26 Thread Tom Cohen
Dear list,   Using ggplot2 I could produce both boxplot and points in the same plot but instead of points I would like to label the different subjects with different colors or their idnumbers. Is there away to do it? Also how can I put three plots on the same graph with ggplot2? mfrow=c(3,1) did

[R] select specific listcomponents to calculate the means

2008-11-21 Thread Tom Cohen
Dear list, I have following list [[1]] Pnr timeCA CACen 1 62083014541 0.008 TRUE 2 62083014542 0.008 TRUE 3 62083014543 0.008 FALSE 4 62083014544 0.013 TRUE 5 62083014545 0.007 FALSE [[2]] Pnr timeCA CACen 1 6403147116

[R] error when using logistic.display within a loop

2008-10-23 Thread Tom Cohen
Dear list, I tried to apply the logistic regression to different response variables from a dataframe and would like to store the results using the function logistic.display from the "epicalc" package in a list, but got an error message "Error in eval(expr, envir, enclos) : y values must

[R] help with calculating the differences between dates

2008-05-12 Thread Tom Cohen
Dear list, How can I calculate the difference in days between the eventdate and basedate in the below dataset? id basedate outcome.3 eventdate daydiff 1 1001 1999-09-28 2 1999-10-013 2 1002 1999-09-22 1 3 1003 2000-01-19 1 4

[R] set the lower bound of normal distribution to 0 ?

2008-04-01 Thread Tom Cohen
Tom Cohen <[EMAIL PROTECTED]> skrev:Thanks Prof Brian for your suggestion. I should know that for right-skewed data, one should generate the samples from a lognormal. My problem is that x and y are two instruments that were thought to be measured the same thing but somehow show

[R] Reorder the x-axis using lattice

2008-03-31 Thread Tom Cohen
Dear list, Is there a way to reorder the xaxis using lattice. Using the following data, the x-axis is ordered as BP GH MH PF RE RP SF VT but I would like the x-axis to be ordered as PF RP BP GH VT SF RE MH. Kön Skalor Tillfälle Medelvärde 1 Kvinnor BP 1-inskrivning

Re: [R] options in 'rnorm' to set the lower bound of normal distribution to 0 ?

2008-03-27 Thread Tom Cohen
a.frame(x=urlnorm(n*i,meanlog=mean_logx,sdlog=sd_logx, > lb=0, ub=max(x)), > y=urlnorm(n*i,meanlog=mean_logy,sdlog=sd_logy, lb=0, ub=max(y))) > } Thanks again for any suggetions. Prof Brian Ripley <[EMAIL PROTECTED]> skrev: On Thu, 27 Mar 2008, Tom Cohen wrote: > > Dear li

[R] options in 'rnorm' to set the lower bound of normal distribution to 0 ?

2008-03-27 Thread Tom Cohen
Dear list, I have a dataset containing values obtained from two different instruments (x and y). I want to generate 5 samples from normal distribution for each instrument based on their means and standard deviations. The problem is values from both instruments are non-negative, so if using

[R] Repeated measures using lme

2008-03-06 Thread Tom Cohen
Dear list, I am trying to do a repeated analysis using lme in R and a little bit unsure if I have set up the right statement. The problem is the IL6 (interleukin 6) was measured 5 times on each individual in each of 6 companies. The hypotheses are to see whether there is a relationship be

[R] Two bwplots in one single graph

2008-02-19 Thread Tom Cohen
Dear list, With the below codes, I got 8 bwplots but I would like to put 2 bwplots in one single graph so that instead of 8 separate bwplots I would have 4 graphs, each contains 2 bwplots. How can I do that? Another question is how do I add the mean as a point to each boxplot in the

[R] Change the color and lines of the legend using bwplot

2008-02-19 Thread Tom Cohen
Dear list, I have following plot, where I have set the color (red and green) and lines (lty=2:3) in the panel.groups but can't not figure out how change the lines and color of the legend in the "key" to the same lines and color as in the panel.groups. bwplot(means ~ age | scales , d

[R] help with bwplot

2008-02-12 Thread Tom Cohen
Dear list, I have following data set, which I want to plot the "Scale" variable on the x-axis and "Mean"´on the y-axis for each Ageclass and for each sex. The Mean value of each Ageclass for each sex would be connected by a line. Totally, there should be 6 lines, from which three present th

[R] Calculate the difference between dates

2008-02-07 Thread Tom Cohen
Dear list, I have two data columns (part of big data frame) containing dates presenting the dates when two measurements (M1 and M2) were taken. The data consists of 73 individuals divided in different groups. Each group was examined at different time points (see M1 date),but the measureme

[R] adding the mean and standard deviation to boxplots

2008-02-04 Thread Tom Cohen
Dear list, How can I add the mean and standard deviation to each of the boxplots using the example provided in the boxplot function? boxplot(len ~ dose, data = ToothGrowth, boxwex = 0.25, at = 1:3 - 0.2, subset = supp == "VC", col = "yellow", main = "Guinea Pigs'

[R] help with checking out-of-range values in each column in data frame

2008-01-28 Thread Tom Cohen
Dear list, I have following data, where I want to check if any value in each column is out of range. For example, column "f1" can only take values 1-5, so if any values less than 1 or > 5 will be defined as missing value (i.e. NA), column "f4" can only take values of 1-3 and any values th

[R] help with replacing all comma in a data frame with a dot

2008-01-23 Thread Tom Cohen
Dear list, I have imported a spss data file in R, where a comma is used to separate the decimal numbers, e.g. 3,567 instead of 3.567 as in R. How can I replace the comma with a dot for all values in the data frame >kk ab c d ef

[R] help with reshaping data into long format (correct question)

2008-01-15 Thread Tom Cohen
Dear list, I have the following data set id 1 2 3 4 5 6 7 8 9 10 disease a b c d e f g h i j age 23 40 32 34 25 32 22 35 29 21 cityNY LD NY SG NY LD VG SA LD SG sex 1 1 2 2 2 2 1 1 1 2 treat_a y y yy treat_b n n

[R] Help with reshape data into long format

2008-01-15 Thread Tom Cohen
Dear list, I have the following data set id 1 2 3 4 5 6 7 8 9 10 disease a b c d e f g h i j age 23 40 32 34 25 32 22 35 29 21 cityNY LD NY SG NY LD VG SA LD SG sex 1 1 2 2 2 2 1 1 1 2 treat_a y y yy treat_b n n

[R] Append the sum of each row and column to a table matrix

2007-09-30 Thread Tom Cohen
Dear list, I have following table ee<-table(ID,Day) ee Day ID2 3 4 5 6 7 9 10 14 16 35 5 0 0 3 1 0 0 5 0 0 36 0 0 0 0 0 0 0 1 0 0 43 13 15 15 0 0 13 13 15 13 15 46 0 1 0 0 0 0 0 0 0 0 58 0 0 0 0 0 0 4 4 0 0 and want to

Re: [R] help with making a function of scatter plot with multiple variables

2007-09-21 Thread Tom Cohen
ot;), text.col=c("orange","green4","navyblue","red","darkviolet","steelblue"), pch=c("v","A","B","C","D","E"),bg='gray100',cex=0.7,box.lty=1,box.lwd=1) abline(h = -1:9, v

[R] help with making a function of scatter plot with multiple variables

2007-09-20 Thread Tom Cohen
Dear list, I have done a scatter plot of multiple variables in the same graph, with different col and pch. I managed to do it with the following code but not know how to make a function of these so that next time if I want to do similar graph but with new variables, I dont have to copy th