[R] Odp: hi

From: Petr PIKAL <petr.pikal_at_precheza.cz>
Date: Thu, 03 May 2007 14:44:34 +0200


Hi

r-help-bounces_at_stat.math.ethz.ch napsal dne 03.05.2007 14:01:27:

> hi,
> I have a problem to use union function because one of the elements is a
> character and the others are numeric
>
> > for(j in 1:length(I)) {
> + C1 <- levels(factor(subset(donParEssai, Id_Essai == 1006961 & Id_Cara
==
> I[j], select = Date_O)[,1]))
> + C2 <- as.numeric(levels(factor(subset(donParEssai, Id_Essai == 1006961
&
> Id_Cara == I[j], select = Stade_O)[,1])))
> + C3 <- length(as.numeric(levels(factor(subset(donParEssai, Id_Essai ==
> 1006961 & Id_Cara == I[j], select = Id_Geno)[,1]))))
> + C4 <- length(levels(factor(subset(donParEssai, Id_Essai == 1006961 &
Id_Cara
> == I[j], select = Id_Rep)[,1])))
> + C5 <- mean(as.numeric(as.character(subset(donParEssai, Id_Essai ==
1006961 &
> Id_Cara == I[j], select = Val_O)[,1])))
> + C6 <- range(as.numeric(as.character(subset(donParEssai, Id_Essai ==
1006961
> & Id_Cara == I[j], select = Val_O)[,1])))
> + C7 <- sd(as.numeric(as.character(subset(donParEssai, Id_Essai ==
1006961 &
> Id_Cara == I[j], select = Val_O)[,1])))
> + RecapCara[j,] <-
union(C1,union(C2,union(C3,union(C4,union(C5,union(C6,C7))))))
> + }
> Erreur dans RecapCara[j, ] <- union(C1, union(C2, union(C3, union(C4,
union(C5, :
> le nombre d'objets remplacer n'est pas multiple de la taille
du remplacement
> > print(RecapCara)
> [,1] [,2] [,3] [,4] [,5] [,6] [,7]
> [1,] NA 21 3 7.66129 5.2 17.1 2.318801
> [2,] NA 21 3 50.56774 47.3 53.9 1.469222
>
> > C1
> [1] "29/08/2005"
>
> I can't paste C1 with others values how could I do to paste C1 with
others please?

Change it to numeric?

Regards
Petr

>
>
>
>



>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 03 May 2007 - 12:59:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 May 2007 - 13:31:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.