HI R users With clara function I get a data frame (maybe this is not the exact word, I'm new to R) with the following variables:> names(myclara)[1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" I want to export "clustering" and "data" to a new text file so I try> write.table(myclara$data,"cluster.dat") > write.table(myclara$clustering,"cluster.dat",append=TRUE)Variable data is properly exported but clustering is not appended to the output file. Please, where is the mistake? is it possible to export the two variables in just a sentence? thanks in advance Paco -- _________________________ El ponent la mou, el llevant la plou Usuari Linux registrat: 363952 ------- Fotos: http://picasaweb.google.es/pacomet [[alternative HTML version deleted]]
try str(myclara) to see what you have - a data frame , matrix etc Are you getting any error messages? I tried your write.table commands and they work okay. --- On Fri, 8/1/08, pacomet <pacomet at gmail.com> wrote:> From: pacomet <pacomet at gmail.com> > Subject: [R] Exporting data to a text file > To: r-help at r-project.org > Received: Friday, August 1, 2008, 12:49 PM > HI R users > > With clara function I get a data frame (maybe this is not > the exact word, > I'm new to R) with the following variables: > > > names(myclara) > [1] "sample" "medoids" > "i.med" "clustering" > "objective" > [6] "clusinfo" "diss" > "call" "silinfo" > "data" > > I want to export "clustering" and > "data" to a new text file so I try > > > write.table(myclara$data,"cluster.dat") > > > write.table(myclara$clustering,"cluster.dat",append=TRUE) > > Variable data is properly exported but clustering is not > appended to the > output file. > > Please, where is the mistake? is it possible to export the > two variables in > just a sentence? > > thanks in advance > > Paco > > -- > _________________________ > El ponent la mou, el llevant la plou > Usuari Linux registrat: 363952 > ------- > Fotos: http://picasaweb.google.es/pacomet > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org 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.
You could try using sink() instead of write.table() to append the clustering . write.table(myclara$data,"cluster.dat") sink("cluster.dat",append=TRUE) print( myclara$clustering ) sink() That will definitely append clustering to the file. -Don At 6:49 PM +0200 8/1/08, pacomet wrote:>HI R users > >With clara function I get a data frame (maybe this is not the exact word, >I'm new to R) with the following variables: > >> names(myclara) > [1] "sample" "medoids" "i.med" "clustering" "objective" > [6] "clusinfo" "diss" "call" "silinfo" "data" > >I want to export "clustering" and "data" to a new text file so I try > > > write.table(myclara$data,"cluster.dat") > > write.table(myclara$clustering,"cluster.dat",append=TRUE) > >Variable data is properly exported but clustering is not appended to the >output file. > >Please, where is the mistake? is it possible to export the two variables in >just a sentence? > >thanks in advance > >Paco > >-- >_________________________ >El ponent la mou, el llevant la plou >Usuari Linux registrat: 363952 >------- >Fotos: http:// picasaweb.google.es/pacomet > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org 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.-- -------------------------------------- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062