[R] Formating the data
Gavin Simpson
gavin.simpson at ucl.ac.uk
Fri Jun 8 15:49:01 CEST 2007
On Fri, 2007-06-08 at 06:13 -0700, A Ezhil wrote:
> Hi All,
>
> I have a vector of length 48, something like:
> 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
>
> I would like to print (reformat) this vector as:
> 001100000000001111111111111111111111111111111111
>
> by simply removing the spaces between them. I have
> been trying with many option but not able to do this
> task.
> I would greatly appreciate your suggestion on fixing
> this simple task.
>
> Thanks in advance.
> dat <- scan()
1: 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1
28: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
49:
Read 48 items
> dat
[1] 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1[39] 1 1 1 1 1 1 1 1 1 1
> print(dat, print.gap = 0)
[1]001100000000001111111111111111111111111111111111
Is that what you want? It is just altering how the data are printed. You
still get the [1] at the start though.
G
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-help
mailing list