I found several question/answer on this topic, but I was not able to resolve my problem ... so I'll ask it my way. Sorry if it is obvious.
I prepared a dataframe (z2) to use with ggplot2. This dataframe contains a column "value" with reals, a column "name" which identifies the parameter tested, a column "loghos" which is the unique ID for each individual, and a column "statut" which is the outcome variable.
I was able to easily plot the "value" according for the "statut" for each "name" with the following code :
pt <- ggplot(z2, aes(y = value, x = statut))
pt + geom_boxplot(aes(colour=statut)) + facet_wrap(~name, scales="free_y")
In the dataframe, I have repeated values for each "name" for each "loghos" (several samples at various timepoints".
I would like to plot only the minimal value for each 'name' and for each 'patient'. So I tried to use plyr for this, and i wrote :
x = ddply(z2, .(loghos,name), function(x) return(min(x,na.rm=T)))
However, i got this error message, and now i don't know was to do ?
Erreur dans FUN(X[[1L]], ...) :
only defined on a data frame with all numeric variables
I'm sure it is no big deal, but I can't find how to write i correctly !
Thanks in advance,
Julien
edited : sample of the data.frame is provided below
y = z2[sample(nrow(z2),20),c(1,2,3,9,11,12,13)]
y
cleBilan name value loghos sexe age statut
80612 328347 plaq 384.00 31218139 M 21 transfert
36304 363835 gb 5.62 41416171 M 72 service
59346 267744 lympho 9.90 30628552 F 22 service
62746 388270 lympho 8.70 41620223 M 78 service
81046 342228 plaq 185.00 41120284 M 19 service
67400 323055 mono 3.10 31273421 F 45 service
35572 335928 gb 16.16 41178061 F 22 transfert
71136 256960 neutro 10.65 30401746 M 71 transfert
34324 293368 gb 16.20 30894579 F 30 service
69010 383939 mono 6.90 41574890 M 22 service
63665 236360 mono 4.40 29970714 M 71 service
31366 233999 gb 7.20 29959612 F 18 service
60867 317932 lympho 12.00 31229099 M 50 service
74487 355581 neutro 10.68 41154330 F 23 service
65520 265864 mono 7.00 30583193 M 78 service
36553 375590 gb 7.10 41489078 M 61 service
65849 268730 mono 3.90 30652360 M 89 deces
80813 354964 plaq 404.00 41120284 M 19 service
31271 232524 gb 6.30 29934806 M 36 service
72789 291335 neutro 11.00 30923095 F 35 service