You'll want to use grep() or grepl(). By default, grep() uses extended
regular expressions to find matches, but you can also use perl regular
expressions and globbing (after converting to a regular expression).
For example:
grepl("^yr", colnames(mydata))
will tell you which 'colnames' start with
mydata[, -grep("^yr",colnames(mydata))]
On Sat, Jan 14, 2023 at 8:57 AM Steven T. Yen wrote:
> I have a data frame containing variables "yr3",...,"yr28".
>
> How do I remove them with a wild cardsomething similar to "del yr*"
> in Windows/doc? Thank you.
>
> > colnames(mydata)
>[1] "yea
I have a data frame containing variables "yr3",...,"yr28".
How do I remove them with a wild cardsomething similar to "del yr*"
in Windows/doc? Thank you.
> colnames(mydata)
[1] "year" "weight" "confeduc" "confothr" "college"
[6] ...
[41] "yr3" "yr4" "yr5"
R's
{ expr1; expr2; expr3}
acts much like C's
( expr1, expr2, expr3)
E.g.,
$ cat a.c
#include
int main(int argc, char* argv[])
{
double y = 10 ;
double x = (printf("Starting... "), y = y + 100, y * 20);
printf("Done: x=%g, y=%g\n", x, y);
return 0;
}
$ gcc -Wall a.c
$ ./a.
09.01.2023 18:05:58 akshay kulkarni :
We are living in the 21st century world, and the R-core team might,I suppose,
have a definite reason ...
Maybe compatibility reasons with S and R-versions from the 20st century?
But maybe, you would have expected some reason even then.
best regards,
Hei
Hello Akshay,
R is quite inspired by LISP, where this is a common thing. It is not in fact
that {...} returned something, rather any expression evalulates to some value,
and for a compound statement that is the last evaluated expression.
{...} might be seen as similar to LISPs (begin ...).
Now
Hi Rui,
Thank you very much. It works beautifully.
On Fri, Jan 13, 2023 at 3:36 PM Rui Barradas wrote:
> Às 05:11 de 13/01/2023, roslinazairimah zakaria escreveu:
> > Hi,
> >
> > I would like to customise my date series on the plot. I tried this:
> >
> > dt_ts <- ts(dt)
> > autoplot(dt_ts[,2])
7 matches
Mail list logo