[R] lattice - change background strip color in one panel

2011-05-27 Thread Coen van Hasselt
Hello, I would like to change the background color in only -one- of the strips in a multipanel lattice xyplot, from the default yellow-brown color. Until now, I only managed to change the background strip color in all of the strips using the par.settings, but I do not get it to work for only 1 str

[R] how to improve this inefficient R code for imputing missing values

2010-11-19 Thread Coen van Hasselt
Hello all, I have a big data.frame multiple studies, subjects and timepoints per subject, i.e. STUDY[,1] SUBJECT[,2] .. WT[,16] HT[,17] TEMP[,18] BSA[,19] 1 150 170 37 1.90 1 1NA

[R] lattice xyplot - formatting of multiple Y variables when using subgroups

2010-10-17 Thread Coen van Hasselt
Hi all, Using xyplot I want to print to Y variables (y1, y2) versus X, conditional on the group. How can I obtain a line (type="l") for one relationship (ie. y1 ~ x) and points (type="p") for the other (y2 ~ x) ? library(lattice) # create some sample data df<-data.frame(group=as.factor(c(rep("a"

[R] reshape to wide format takes extremely long

2010-09-02 Thread Coen van Hasselt
Hello, I have a data.frame with the following format: > head(clin2) Study Subject Type Obs Cycle Day Date Time 1 A001101 10108 ALB 44.098 1 2004-03-11 14:26 2 A001101 10108 ALP 95.098 1 2004-03-11 14:26 3 A001101 10108 ALT 61.098 1 2004-0

[R] xyplot: filtering out empty plots

2010-07-06 Thread Coen van Hasselt
Hello, I would like to know how I can filter out empty plots in xyplot, when stratifying on some variables. Example: I have a dataset in which I plot CONC ~ TIME, stratified for patient ID(1,2,..,100), FORM(1,2) and BOOST (1,2). Some patients (ID's) do not have values for all stratification cond

Re: [R] Reading comments in text file from R

2009-12-02 Thread Coen van Hasselt
Try readLines, for instance: # test.txt contents comments a,b,c 1,1,1 2,2,2 > readLines("c:/test.txt",1) [1] "comments" > read.csv("c:/test.txt",skip=1) a b c 1 1 1 1 2 2 2 2 Coen On Wed, Dec 2, 2009 at 19:26, Graham Smith wrote: > When a text file starts with a few lines commented out with

Re: [R] Generate missing data patterns

2009-12-02 Thread Coen van Hasselt
Hi Andreas, > ## does not exactly what i want, because i get rows > ## of missinges pattern which are not in R > X[rbinom(100,1,p[1])==1,R[1,]==1] <- NA > X[rbinom(100,1,p[2])==1,R[2,]==1] <- NA > X[rbinom(100,1,p[3])==1,R[3,]==1] <- NA > X[rbinom(100,1,p[4])==1,R[4,]==1] <- NA If you run these l

Re: [R] Most used R editors

2009-06-03 Thread Coen van Hasselt
Here also a Eclipse + StatET user. I like the way you can manage different projects and keep your scripts and auxiliary files organized from within Eclipse, and also functionality such as revisions, tasks etc. On Tue, Jun 2, 2009 at 17:06, Martial Sankar wrote: > > Hi, > > I am a little lonely as

Re: [R] string to integer

2009-04-16 Thread Coen van Hasselt
?as.integer xChar<-as.character(c(1,2,3)) xInt<-as.integer(xChar) On Fri, Apr 17, 2009 at 09:38, Romildo Martins wrote: > Hi, > > exists a function to converts string to integer? > > Thanks > > Romildo Martins > > __ > R-help@r-project.org mailing list

Re: [R] excluding a column from a data frame

2009-04-14 Thread Coen van Hasselt
Alternatively you could also drop the column like this: xx$x2<-NULL On Wed, Apr 15, 2009 at 15:51, Peter Alspach wrote: > Tena koe Erin > > xx[, names(xx)!='x2'] > > HTH > > Peter Alspach > >> -Original Message- >> From: r-help-boun...@r-project.org >> [mailto:r-help-boun...@r-proj

Re: [R] Writing specific columns to a data file

2009-04-06 Thread Coen van Hasselt
By only selecting the first column, i.e. write.table(data[,1], file="", .) ? On Tue, Apr 7, 2009 at 12:28, Brendan Morse wrote: > Hi, I have a function that generates some output with 2 columns, but I > only want to write the first column to a file. Is there a way to do > this in the write.t

Re: [R] a loop for boxplot graphs

2009-03-29 Thread Coen van Hasselt
Oops, the example only accounts for 1 observation, so better do something like this in that case: .. for (i in unique(dat$id)){ .. On Mon, Mar 30, 2009 at 07:50, Coen van Hasselt wrote: > You could use the paste() function to dynamically assign label values. > For instance, like this: &

Re: [R] a loop for boxplot graphs

2009-03-29 Thread Coen van Hasselt
You could use the paste() function to dynamically assign label values. For instance, like this: dat<-data.frame(id=1:4,x=1:4,y=1:4) par(mfrow=c(2,2)) for (i in dat$id){ boxplot(dat$x[dat$id==i], dat$y[dat$id==i], main=paste("Results for Subject",i) ) } There might be a better

Re: [R] Output an RWeka model via sink

2009-03-28 Thread Coen van Hasselt
I tried your code and it seems to work fine; the file contains the expected output. I used R 2.8.1 on WinXP. On Sun, Mar 29, 2009 at 07:48, Francisco Javier Perez Caballero wrote: > When I sink the output of an RWeka model to a text file, the output file > appears empty: > > library(RWeka) > mod

Re: [R] A beginner's question

2009-03-27 Thread Coen van Hasselt
Here's an example: mydata<-data.frame(skill=c(1,2,3,4),x=c(1,1,1,1)) mydata[mydata$skill==1,] On Fri, Mar 27, 2009 at 16:40, minben wrote: > I am a new R-language user. I have set up a data frame "mydata",one of > the colume of which is "skill". Now I want to select the observations > whose "sk