Displaying 3 results from an estimated 3 matches for "serag".
Did you mean:
sera
2018 May 22
0
remove rows of a matrix by part of its row name
...ou want to remove just the ones
with exactly 73.1 use the pattern
grep("^73\\.1$", etc)
Explanation:
Beginning of string: ^
End of string: $
Escape special characters: \\ (needed because the period is a special
character.)
Hope this helps,
Rui Barradas
On 5/22/2018 12:50 PM, Ahmed Serag wrote:
> Thank you Mr. Barradas. The code works great. Unfortunately I have also
> some labeles with
>
>
> 173.1
>
> 273.1
>
>
> the grep script remove them also ?
>
> Any ideas Plz, Thanks again
>
>
> ************************
>
> *Ahmed...
2018 May 22
4
remove rows of a matrix by part of its row name
...f its name. To be clear, I have a matrix with 766 observations as a rows. The row names are like this
70/556
71.1/280
72.1/556
72.1/343
73.1/390
73.1/556
Now I would like to remove all the rows that contain the text 73.1
Any ideas or suggestion please ?
Regards
**********************
Ahmed Serag
Analytical Chemistry Department
Faculty of Pharmacy
Al-Azhar University
Cairo
Egypt
[[alternative HTML version deleted]]
2018 May 22
0
remove rows of a matrix by part of its row name
...character(), text = "
70/556
71.1/280
72.1/556
72.1/343
73.1/390
73.1/556
")
mat <- matrix(rnorm(6*6), nrow = 6)
row.names(mat) <- rn
inx <- grep("73\\.", row.names(mat))
new_mat <- mat[-inx, ]
new_mat
Hope this helps,
Rui Barradas
On 5/22/2018 11:48 AM, Ahmed Serag wrote:
> Dear R-experts,
>
>
> How can I remove a certain feature or observation by a part of its name. To be clear, I have a matrix with 766 observations as a rows. The row names are like this
>
> 70/556
> 71.1/280
> 72.1/556
> 72.1/343
> 73.1/390
> 73.1/556
>...