[R] permutations

jim holtman jholtman at gmail.com
Sun Oct 11 02:49:10 CEST 2009


try this to get the column output:

cat(x, sep='\n', file='/tempxx.txt')

For the transposed out, do:

write.table(t(x), file="filename.txt", row.names=F, col.names=F)

On Sat, Oct 10, 2009 at 2:09 PM, Eiger <c_cb at hotmail.it> wrote:
>
> Hi, I have a question about "how" write output in a .txt file.
>
> With tihs command, I write permutations of the numbers (1,2,3) in a .txt
> file:
>
>> x<-permn(c(1,2,3))
>> write.table(x, file="filename.txt", row.names=F, col.names=F)
>
> This is output in filename.txt:
>
> 1 1 3 3 2 2
> 2 3 1 2 3 1
> 3 2 2 1 1 3
> ____________________________________
> Is possible write output trasposed?
> Output:
>
>
>
> etc..
> ____________________________________
> Is possible write output in a single column?
> Output:
> 1
> 2
> 3
> 1
> 3
> 2
> 3
> 1
> 2
> etc. etc.
> _____________________
>
> Thanks,
> E.
>
>
>
> --
> View this message in context: http://www.nabble.com/permutations-tp25834463p25836847.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list