gt; Realistically, the above technique generalizes to more complex cases
> decently. But sometimes, head(0 and other things I mentioned earlier work
> quite well.
>
>
> -Original Message-----
> From: R-help On Behalf Of Upananda Pani
> Sent: Sunday, February 5, 2023 2:3
ani
Sent: Sunday, February 5, 2023 2:33 PM
To: Andrés González Carmona
Cc: r-help
Subject: Re: [R] Extracting data using subset function
Thank you. It means we can not use the subset function here.
Regards
On Mon, 6 Feb, 2023, 00:53 Andrés González Carmona, wrote:
> From ?subset:
> Warn
On Sun, 5 Feb 2023 15:13:54 -0500
Duncan Murdoch wrote:
>
> Just to build the mountain a little higher, I would use
>
>subset(p, seq_along(p) <= 20)
>
> You should generally avoid expressions like "1:length(p)", because
> they don't do what you would expect in the unusual case that p is
Às 22:14 de 05/02/2023, Rui Barradas escreveu:
Às 19:33 de 05/02/2023, Upananda Pani escreveu:
Thank you. It means we can not use the subset function here.
Regards
On Mon, 6 Feb, 2023, 00:53 Andrés González Carmona,
wrote:
From ?subset:
Warning
This is a convenience function intended fo
Às 19:33 de 05/02/2023, Upananda Pani escreveu:
Thank you. It means we can not use the subset function here.
Regards
On Mon, 6 Feb, 2023, 00:53 Andrés González Carmona, wrote:
From ?subset:
Warning
This is a convenience function intended for use interactively. For
programming it is better
a single
vector.
-Original Message-
From: R-help On Behalf Of Upananda Pani
Sent: Sunday, February 5, 2023 2:33 PM
To: Andrés González Carmona
Cc: r-help
Subject: Re: [R] Extracting data using subset function
Thank you. It means we can not use the subset function here.
Regards
On Mon, 6 Feb, 20
Hi Upananda,
As a couple of respondents noted, you only need the logical statement,
not subset().
You did "frame the logical condition" in your example, for if you use
the extraction operator "[" this will work:
subset(p,(1:length(p)) <= 20)
as Jeff already pointed out. Obviously it is easier to w
, albeit you can make a data.frame containing a single
vector.
-Original Message-
From: R-help On Behalf Of Upananda Pani
Sent: Sunday, February 5, 2023 2:33 PM
To: Andrés González Carmona
Cc: r-help
Subject: Re: [R] Extracting data using subset function
Thank you. It means we can no
I will not (re-)define the basic terms used in describing how R is used... do
read [1] for that.
[1]
https://cran.r-project.org/doc/manuals/r-release/R-intro.html#Writing-your-own-functions,
also via RShowDoc("R-intro"), in particular contrast section 1.5 vs section 10.
On February 5, 2023 12:
Hi Rolf,
Thank you so much. I was just curious to know that. I am glad that i got
the input from all of you.
I am grateful to you for clarifying.
With sincere gratitude,
Upananda
On Mon, Feb 6, 2023 at 1:29 AM Rolf Turner wrote:
> On Sun, 5 Feb 2023 19:37:03 +0530
> Upananda Pani wrote:
>
>
Hi Jeff,
Thanks for your reply. What do you exactly mean by "interactively"? Would
you please give me an example?
Upananda
On Mon, Feb 6, 2023 at 1:27 AM Jeff Newmiller
wrote:
> No, it means what it says: it is best used interactively rather than in
> functions. That is not saying you cannot u
On 05/02/2023 2:59 p.m., Rolf Turner wrote:
On Sun, 5 Feb 2023 19:37:03 +0530
Upananda Pani wrote:
Dear All,
I want to create a vector p and extract first 20 observations using
subset function based on logical condition.
My code is below
p <- 0:100
I know i can extract the first 20 observa
On Sun, 5 Feb 2023 19:37:03 +0530
Upananda Pani wrote:
> Dear All,
>
> I want to create a vector p and extract first 20 observations using
> subset function based on logical condition.
>
> My code is below
>
> p <- 0:100
>
> I know i can extract the first 20 observations using the following
>
No, it means what it says: it is best used interactively rather than in
functions. That is not saying you cannot use it... merely that you should
probably use it interactively.
The fact is, though, that integer indexing is much simpler and clearer for your
particular example than subset is.
q
Thank you. It means we can not use the subset function here.
Regards
On Mon, 6 Feb, 2023, 00:53 Andrés González Carmona, wrote:
> From ?subset:
> Warning
>
> This is a convenience function intended for use interactively. For
> programming it is better to use the standard subsetting functions li
How you have defined z1?
On Mon, 6 Feb, 2023, 00:14 粕谷英一, wrote:
> Do you mean something like the following? Here the first elements are
> selected by subset function.
>
> > x1
> [1] 9 8 7 6 5 4 3
> > z1
> [1] TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE
> > subset(x1,z1)
> [1] 9 8 7
>
Do you mean something like the following? Here the first elements are
selected by subset function.
> x1
[1] 9 8 7 6 5 4 3
> z1
[1] TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE
> subset(x1,z1)
[1] 9 8 7
2023年2月6日(月) 3:34 Upananda Pani :
>
> No i am teaching Econometrics and learning R. I
No i am teaching Econometrics and learning R. I am not a student.
Thank you
Upananda
On Sun, 5 Feb, 2023, 19:51 Chris Ryan via R-help,
wrote:
> Is this a homework problem?
>
> --Chris Ryan
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>
> On February 5, 2023 9:07:0
Is this a homework problem?
--Chris Ryan
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
On February 5, 2023 9:07:03 AM EST, Upananda Pani
wrote:
>Dear All,
>
>I want to create a vector p and extract first 20 observations using subset
>function based on logical conditio
19 matches
Mail list logo