2023 10:34 PM
To: avi.e.gr...@gmail.com
Cc: Bert Gunter ; R-help@r-project.org
Subject: Re: [R] Problem with filling dataframe's column
Consider
m <- list(foo=c(1,2),"B'ar"=as.matrix(1:4,2,2),"!*#"=c(FALSE,TRUE))
It is a collection of elements of different t
times be a good think. As far as I can tell, external
> interface seem the same for now.
>
> One issue with R for a long time was how they did not do something more
> like a Python dictionary and it looks like …
>
> ABOVE
>
> From: Bert Gunter
> Sent: Tuesday, June 13,
and it looks like …
ABOVE
From: Bert Gunter
Sent: Tuesday, June 13, 2023 6:15 PM
To: avi.e.gr...@gmail.com
Cc: javad bayat ; R-help@r-project.org
Subject: Re: [R] Problem with filling dataframe's column
Below.
On Tue, Jun 13, 2023 at 2:18 PM mailto:avi.e.gr...@gmail.com>
ot; and others
like me call programming and that don't necessarily fit well together.
>
>
> -Original Message-
> From: R-help r-help-boun...@r-project.org On Behalf Of javad bayat
> Sent: Tuesday, June 13, 2023 3:47 PM
> To: Eric Berger ericjber...@gmail.com <mail
day, June 13, 2023 3:47 PM
To: Eric Berger ericjber...@gmail.com <mailto:ericjber...@gmail.com>
Cc: R-help@r-project.org <mailto:R-help@r-project.org>
Subject: Re: [R] Problem with filling dataframe's column
Dear all;
I used these codes and I get what I wanted.
Sincerely
pat = c(&q
It is safer to use !grepl(...) instead of -grep(...) here. If there are no
matches, the latter will give you a zero-row data.frame while the former
gives you the entire data.frame.
E.g.,
> d <- data.frame(a=c("one","two","three"), b=c(10,20,30))
> d[-grep("Q", d$a),]
[1] a b
<0 rows> (or 0-lengt
Às 17:18 de 13/06/2023, javad bayat escreveu:
Dear Rui;
Hi. I used your codes, but it seems it didn't work for me.
pat <- c("_esmdes|_Des Section|0")
dim(data2)
[1] 281549 9
grep(pat, data2$Layer)
dim(data2)
[1] 281549 9
What does grep function do? I expected the funct
Dear all;
I used these codes and I get what I wanted.
Sincerely
pat = c("Level 12","Level 22","0")
data3 = data2[-which(data2$Layer == pat),]
dim(data2)
[1] 281549 9
dim(data3)
[1] 244075 9
On Tue, Jun 13, 2023 at 11:36 AM Eric Berger wrote:
> Hi Javed,
> grep returns the positions of
Hi Javed,
grep returns the positions of the matches. See an example below.
> v <- c("abc", "bcd", "def")
> v
[1] "abc" "bcd" "def"
> grep("cd",v)
[1] 2
> w <- v[-grep("cd",v)]
> w
[1] "abc" "def"
>
On Tue, Jun 13, 2023 at 8:50 AM javad bayat wrote:
>
> Dear Rui;
> Hi. I used your codes, but it
Dear Rui;
Hi. I used your codes, but it seems it didn't work for me.
> pat <- c("_esmdes|_Des Section|0")
> dim(data2)
[1] 281549 9
> grep(pat, data2$Layer)
> dim(data2)
[1] 281549 9
What does grep function do? I expected the function to remove 3 rows of the
dataframe.
I do no
Às 23:13 de 12/06/2023, javad bayat escreveu:
Dear Rui;
Many thanks for the email. I tried your codes and found that the length of
the "Values" and "Names" vectors must be equal, otherwise the results will
not be useful.
For some of the characters in the Layer column that I do not need to be
fill
mutate() or other methods.
-Original Message-
From: R-help On Behalf Of javad bayat
Sent: Sunday, June 11, 2023 4:05 PM
To: R-help@r-project.org
Subject: [R] Problem with filling dataframe's column
Dear R users;
I am trying to fill a column based on a specific value in another colum
Às 13:18 de 11/06/2023, Rui Barradas escreveu:
Às 22:54 de 11/06/2023, javad bayat escreveu:
Dear Rui;
Many thanks for your email. I used one of your codes,
"data2$LU[which(data2$Layer == "Level 12")] <- "Park"", and it works
correctly for me.
Actually I need to expand the codes so as to conside
Às 22:54 de 11/06/2023, javad bayat escreveu:
Dear Rui;
Many thanks for your email. I used one of your codes,
"data2$LU[which(data2$Layer == "Level 12")] <- "Park"", and it works
correctly for me.
Actually I need to expand the codes so as to consider all "Levels" in the
"Layer" column. There are
Dear Rui;
Many thanks for your email. I used one of your codes,
"data2$LU[which(data2$Layer == "Level 12")] <- "Park"", and it works
correctly for me.
Actually I need to expand the codes so as to consider all "Levels" in the
"Layer" column. There are more than hundred levels in the Layer column.
If
Às 21:05 de 11/06/2023, javad bayat escreveu:
Dear R users;
I am trying to fill a column based on a specific value in another column of
a dataframe, but it seems there is a problem with the codes!
The "Layer" and the "LU" are two different columns of the dataframe.
How can I fix this?
Sincerely
Dear R users;
I am trying to fill a column based on a specific value in another column of
a dataframe, but it seems there is a problem with the codes!
The "Layer" and the "LU" are two different columns of the dataframe.
How can I fix this?
Sincerely
for (i in 1:nrow(data2$Layer)){
if (d
17 matches
Mail list logo