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, <andre...@ugr.es> wrote: > From ?subset: > Warning > > This is a convenience function intended for use interactively. For > programming it is better to use the standard subsetting functions like [ > <http://127.0.0.1:21786/library/base/help/%5B>, and in particular the > non-standard evaluation of argument subset can have unanticipated > consequences. > > El 05/02/2023 a las 15:07, Upananda Pani escribió: > > 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 command. > > q <- p[1:20] > > But I want to extract the first 20 observations using subset function which > requires a logical condition. I am not able to frame the logical condition. > > The code should be > > q <- subset(p, logical condition) > > I am not able to do it. Please let me know what you think. > > Best regards, > Upananda > > [[alternative HTML version deleted]] > > ______________________________________________r-h...@r-project.org mailing > list -- To UNSUBSCRIBE and more, > seehttps://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-help__;!!D9dNQwwGXtA!SLdwTGqSfhwUo4CfbUJFeL7hETw64hOG8MQ0FK_o5YdnvVHaOp9Qxs4D7d5e10hj3YQ8EuaFc8qbnkynoP5dEA$ > PLEASE do read the posting guide > https://urldefense.com/v3/__http://www.R-project.org/posting-guide.html__;!!D9dNQwwGXtA!SLdwTGqSfhwUo4CfbUJFeL7hETw64hOG8MQ0FK_o5YdnvVHaOp9Qxs4D7d5e10hj3YQ8EuaFc8qbnkwuss43hA$ > and provide commented, minimal, self-contained, reproducible code. > > -- > * Andrés González Carmona * > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.