> I want to print this vector into a file
> 
> > myvec
>   [1] --Control --Control --Control --Control --Control HBA2      HBA1
>   [8] HBA1      --Control HBB       --Control HBB       HBA1      MBP
[...]
> 
> However using this command:
> write(myvec, "output.txt", sep="\n")
> 
> I get this instead in my output.txt:
> 
> 1
> 1
> 1
> 1
> 1
> 6241
> 6240
> 6240
> 1
> 6242
> 1
> 6242
> 6240
> ....
> 
> What's wrong with my command above?

I think your vector is a factor and what ends up in your file is the
internal representation of the factor.  Try this instead:

write(as.character(myvec), "output.txt", sep="\n")

cu
        Philipp


-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel

______________________________________________
R-help@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.

Reply via email to