arguments imply differing number of rows

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

arguments imply differing number of rows

Shivi Bhatia-2
Hi Team,

I using the syntax as:

data.df<- data.frame(
  city= c(rep(c("Delhi", "Bangalore","Chandigarh"),each=5)),
  population= c(4000:6000,3500:4300,3000:3200)
)

But i am getting the error as arguments imply differing number of rows: 15,
3003.

Tried searching google but could not understand & find the solution.

Thanks, Shivi

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: arguments imply differing number of rows

Bob O'Hara-2
4000:6000 gives you 4000, 4001, ..., 6000. I suspect you want
population= c(seq(4000, 6000, length=5), seq(3500, 4300, length=5),
seq(3000, 3200, length=5))

Bob

On 20 September 2017 at 17:07, Shivi Bhatia <[hidden email]> wrote:

> Hi Team,
>
> I using the syntax as:
>
> data.df<- data.frame(
>   city= c(rep(c("Delhi", "Bangalore","Chandigarh"),each=5)),
>   population= c(4000:6000,3500:4300,3000:3200)
> )
>
> But i am getting the error as arguments imply differing number of rows: 15,
> 3003.
>
> Tried searching google but could not understand & find the solution.
>
> Thanks, Shivi
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.



--
Bob O'Hara
NOTE NEW ADDRESS!!!
Institutt for matematiske fag
NTNU
7491 Trondheim
Norway

Mobile: +49 1515 888 5440
Journal of Negative Results - EEB: www.jnr-eeb.org

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: arguments imply differing number of rows

Bert Gunter-2
In reply to this post by Shivi Bhatia-2
What do you think

4000:6000

means?

Perhaps you need to spend time with an R tutorial or two and stop searching
google.

Cheers,
Bert



Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Wed, Sep 20, 2017 at 8:07 AM, Shivi Bhatia <[hidden email]> wrote:

> Hi Team,
>
> I using the syntax as:
>
> data.df<- data.frame(
>   city= c(rep(c("Delhi", "Bangalore","Chandigarh"),each=5)),
>   population= c(4000:6000,3500:4300,3000:3200)
> )
>
> But i am getting the error as arguments imply differing number of rows: 15,
> 3003.
>
> Tried searching google but could not understand & find the solution.
>
> Thanks, Shivi
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: arguments imply differing number of rows

Rui Barradas
In reply to this post by Shivi Bhatia-2
Hello,

Just count:
   city is 3*5 == 15,
   population is length(4000:6000) + length(3500:4300) + length(3000:3200)
                 == 2001 + 801 + 201 == 3003
Hope this helps,

Rui Barradas



Citando Shivi Bhatia <[hidden email]>:

> Hi Team,
>
> I using the syntax as:
>
> data.df<- data.frame(
>   city= c(rep(c("Delhi", "Bangalore","Chandigarh"),each=5)),
>   population= c(4000:6000,3500:4300,3000:3200)
> )
>
> But i am getting the error as arguments imply differing number of rows: 15,
> 3003.
>
> Tried searching google but could not understand & find the solution.
>
> Thanks, Shivi
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: arguments imply differing number of rows

Shivi Bhatia-2
In reply to this post by Bob O'Hara-2
Thank you Bob, this is what i was looking for. Really appreciate.

Regards, Shivi

On Wed, Sep 20, 2017 at 8:41 PM, Bob O'Hara <[hidden email]> wrote:

> 4000:6000 gives you 4000, 4001, ..., 6000. I suspect you want
> population= c(seq(4000, 6000, length=5), seq(3500, 4300, length=5),
> seq(3000, 3200, length=5))
>
> Bob
>
> On 20 September 2017 at 17:07, Shivi Bhatia <[hidden email]> wrote:
> > Hi Team,
> >
> > I using the syntax as:
> >
> > data.df<- data.frame(
> >   city= c(rep(c("Delhi", "Bangalore","Chandigarh"),each=5)),
> >   population= c(4000:6000,3500:4300,3000:3200)
> > )
> >
> > But i am getting the error as arguments imply differing number of rows:
> 15,
> > 3003.
> >
> > Tried searching google but could not understand & find the solution.
> >
> > Thanks, Shivi
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
>
>
> --
> Bob O'Hara
> NOTE NEW ADDRESS!!!
> Institutt for matematiske fag
> NTNU
> 7491 Trondheim
> Norway
>
> Mobile: +49 1515 888 5440
> Journal of Negative Results - EEB: www.jnr-eeb.org
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.