Of course! Use regexec() and regmatches()
>
regmatches(dat$varx,regexec("(^[[:digit:]]{1,3})([[:alpha:]]{1,2})([[:digit:]]{1,5}$)",dat$varx))
[[1]]
[1] "9F209" "9" "F" "209"
[[2]]
character(0)
[[3]]
[1] "2F250" "2" "F" "250"
[[4]]
character(0)
[[5]]
character(0)
[[6]]
characte
Thank you so much Bert.
Is it possible to split the varx into three ( area code, region and
the numeric part)as a separate variable
On Thu, Nov 28, 2019 at 7:31 PM Bert Gunter wrote:
>
> Use regular expressions.
>
> See ?regexp and ?grep
>
> Using your example:
>
> > grep("^[[:digit:]]{1,3}[[:
Use regular expressions.
See ?regexp and ?grep
Using your example:
> grep("^[[:digit:]]{1,3}[[:alpha:]]{1,2}[[:digit:]]{1,5}$",dat$varx,value
= TRUE)
[1] "9F209" "2F250" "121FL50"
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking
Hi all, I want to remove a row based on a condition in one of the
variables from a data frame.
When we split this string it should be composed of 3-2- 5 format (3
digits numeric, 2 characters and 5 digits numeric). Like
area code -region-numeric. The max length of the area code should be
3, the
Warning: This may be off topic, but as several éminences grises have now
offered comments, I recommend this striking discussion on many related
issues by yet another éminence grise.
https://academic.oup.com/aje/article/186/6/639/3886035
**PLEASE DO NOT REPLY ON LIST** This is not the place for a
I'm not going to comment at all on the original question, but on a very common
--
and often troublesome -- mixing of viewpoints about data modelling.
R and other software is used to "fit equations to data" and to "estimate
models".
Unfortunately, a good bit of both these tasks is common. Usually
Dear Ashim,
Please see my brief remarks below:
> On Nov 28, 2019, at 11:02 AM, Ashim Kapoor wrote:
>
> On Thu, Nov 28, 2019 at 7:38 PM Fox, John wrote:
>
>> Dear Ashim,
>>
>> I'm afraid that much of what you say here is confused.
>>
>> First, because poly(x) and poly(x, raw=TRUE) produce th
Dear Ashim
As John said your two examples give the same model to within rounding
error so it is not clear what you see the problem as being. You can
always remove some of the correlation by subtracting out a large
constant from x before you use poly() on it.
Michael
On 28/11/2019 16:02, Ash
On Thu, Nov 28, 2019 at 7:38 PM Fox, John wrote:
> Dear Ashim,
>
> I'm afraid that much of what you say here is confused.
>
> First, because poly(x) and poly(x, raw=TRUE) produce the same fitted
> values (as I previously explained), they also produce the same residuals,
> and consequently the sam
Dear Ashim,
I'm afraid that much of what you say here is confused.
First, because poly(x) and poly(x, raw=TRUE) produce the same fitted values (as
I previously explained), they also produce the same residuals, and consequently
the same CV criteria. From the point of view of CV, there's therefor
10 matches
Mail list logo