Re: [R] Finding strings in a dataset

2021-05-16 Thread Tuhin Chakraborty
Thank you. This possibly will work. Tuhin Chakraborty PhD Geology & Geophysics Indian Institute Of Technology, Kharagpur Kharagpur-721302 On Sun, May 16, 2021 at 1:58 PM Rui Barradas wrote: > Hello, > > You can also create an extra column with the column names corresponding > to the column col.

Re: [R] Create a function problem

2021-05-16 Thread PIKAL Petr
Hi. You also could try functions melt/cast from reshape2 package. https://seananderson.ca/2013/10/19/reshape/ Cheers Petr > -Original Message- > From: R-help On Behalf Of Kai Yang via R- > help > Sent: Saturday, May 15, 2021 2:55 AM > To: r-help@r-project.org; Rolf Turner > Subject: R

Re: [R] Finding strings in a dataset

2021-05-16 Thread Rui Barradas
Hello, You can also create an extra column with the column names corresponding to the column col. I believe this extra column is not needed and with a big data set it's even a waste of time and memory space but the code below creates it. res <- which(found, arr.ind = TRUE) res <- as.data.fr

Re: [R] Finding strings in a dataset

2021-05-16 Thread Rui Barradas
Hello, The data makes clearer. Do you want to know where are the values that cannot be coerced to numeric? The auxiliary function f outputs a logical vector, sapply applies it column by column and which(., arr.ind) gives the TRUE values as (row, col) pairs. txt <- " LI(PPM) SC(PPM) TI(PPM) V