The csv file is exactly as you describe it.  ";35" represents two columns of
data.  If you read it is, you will probably get NA as the value in the first
column.  So what problem are you having in reading in the data?

> x <- read.csv(textConnection("8;32
+ 9;33
+ 10;34
+  ;35
+  ;36
+  ;37
+  ;38"), header=FALSE, sep=';')
> closeAllConnections()
> x
  V1 V2
1  8 32
2  9 33
3 10 34
4 NA 35
5 NA 36
6 NA 37
7 NA 38


On Fri, Dec 4, 2009 at 5:49 AM, Maithili Shiva <maithili_sh...@yahoo.com>wrote:

>
> Dear Mr Signer and Mr Cleland,
>
> Thanks a lot for you great help. However, the output which I am getting is
> as given below -
>
>
>
>
>
>
>
> x
>
> 1;25
>
> 2;26
>
> 3;27
>
> 4;28
>
> 5;29
>
> 6;30
>
> 7;31
>
> 8;32
>
> 9;33
>
> 10;34
>
>  ;35
>
>  ;36
>
>  ;37
>
>  ;38
>
>  ;39
>
>  ;40
>
>  ;41
>
>  ;42
>
>  ;43
>
>  ;44
>
>  ;45
>
>  ;46
>
>  ;47
>
>  ;48
>
>  ;49
>
>  ;50
>
> However, my requirement is I should get the csv file as
>
> M             N
> 1             25
> 2             26
> 3             27
> ................
>
> 10           34
>                35
>                36
>                37
>
> ......................
> ......................
>                50
>
> So that I can acrry out further calcualtions on this output file. Please
> guide.
>
> Regards
>
> Maithili
>
> --- On Fri, 4/12/09, Johannes Signer <j.m.sig...@gmail.com> wrote:
>
>
> From: Johannes Signer <j.m.sig...@gmail.com>
> Subject: Re: [R] writing 'output.csv' file
> To: "Maithili Shiva" <maithili_sh...@yahoo.com>
> Date: Friday, 4 December, 2009, 10:29 AM
>
>
> Hello,
>
> maybe that helps:
>
> write.csv(paste((c(m,rep(" ",length(N)-length(M)))),n, sep=";"),
> "output.csv", row.names=F)
>
> Johannes
>
>
> On Fri, Dec 4, 2009 at 11:12 AM, Maithili Shiva <maithili_sh...@yahoo.com>
> wrote:
>
> Dear R helpers
>
> Suppose
>
> M <- c(1:10)      #  length(M) = 10
> N <- c(25:50)     #  length(N) = 26
>
> I wish to have an outut file giving M and N. So I have tried
>
> write.csv(data.frame(M, N), 'output.csv', row.names = FALSE)
>
> but I get the following error message
>
> Error in data.frame(M, N) :
>   arguments imply differing number of rows: 10, 26
>
> How do I modify my write.csv command to get my output in a single (csv)
> file irrespective of lengths.
>
> Plese Guide
>
> Thanks in advance
>
> Maithili
>
>
>
>      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
>
>
> [[elided Yahoo spam]]
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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<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?

        [[alternative HTML version deleted]]

______________________________________________
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