Gianni,

I think the problem is that you call sample twice. Do something like:

df <- data.frame(matrix(1:240,nrow=120))
s <- sample(120)
df1 <- df[s[1:80],]
df2 <- df[s[81:120],]

Robert

On Thu, Oct 8, 2009 at 9:45 PM, gianni lavaredo
<[email protected]>wrote:

> thanks for help
>
> I have a data.frame with 121 rows. I wish to split random in two
> data.frames
> (first = 80 rows and second = 41 rows). I try this code
>
> dat1 <- AnalysisDF_clean[sample(1:nrow(AnalysisDF_clean),
> 80,replace=FALSE),]
> dat2 <- AnalysisDF_clean[sample(1:nrow(AnalysisDF_clean),
> 41,replace=FALSE),]
>
> but I have a problem because in dat2 sometimes there are some value present
> in dat1.
>
> thanks
>
> Gianni
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [email protected]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to