agrep insists on matching millisecond (and not just second)Aggregate by year and month for a POSIX variableissue with agrepHow does agrep matching work?agrep string matching in RR lubridate, Calculate Age including Leap YearsWhy does agrep in R not find the best match?Construct a loop to compare two dataframes and fill the missing valuesfuzzy string matching with agrep()ggplot2 axis for time durations on a log-like scaleConvert H2OFrame object from milliseconds to Minutes?

Why does putting a dot after the URL remove login information?

Why do implementations of "stdint.h" disagree on the definition of UINT8_C?

Beta value of the thermistor

Is it really ~648.69 km/s Delta-V to "Land" on the Surface of the Sun?

Did WWII Japanese soldiers engage in cannibalism of their enemies?

How can I tell if a flight itinerary is fake

Secure my password from unsafe servers

Short story about a teenager who has his brain replaced with a microchip (Psychological Horror)

Capacitors with a "/" on schematic

How to avoid ci-driven development..?

Do other countries guarantee freedoms that the United States does not have?

What can make Linux unresponsive for minutes when browsing certain websites?

What word can be used to describe a bug in a movie?

WordCloud: do not eliminate duplicates

Did Apollo leave poop on the moon?

How to realistically deal with a shield user?

Why couldn't soldiers sight their own weapons without officers' orders?

How quickly could a country build a tall concrete wall around a city?

Traveling from Germany to other countries by train?

Need help understanding lens reach

Why do private jets such as Gulfstream fly higher than other civilian jets?

In what sense are the equations of motion conserved by symmetries?

Why should I "believe in" weak solutions to PDEs?

Does the Voyager team use a wrapper (Fortran(77?) to Python) to transmit current commands?



agrep insists on matching millisecond (and not just second)


Aggregate by year and month for a POSIX variableissue with agrepHow does agrep matching work?agrep string matching in RR lubridate, Calculate Age including Leap YearsWhy does agrep in R not find the best match?Construct a loop to compare two dataframes and fill the missing valuesfuzzy string matching with agrep()ggplot2 axis for time durations on a log-like scaleConvert H2OFrame object from milliseconds to Minutes?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm trying to get agrep to match seconds to second and not millisecond, but there doesn't seem to be any value of costs to accomplish this.



I am especially confused that there's no value of the cost for deletions/insertions that seems to do the trick -- as I see it, second is one deletion from seconds whereas millisecond is one deletion and 5 insertions.



(warning that the lapply might take a while... you would get the same result for length.out = 10 and 0:10 much quicker)



rng = c(seq(0, 1, length.out = 20), 0:100)
x = expand.grid(insertions = rng, substitutions = rng, deletions = rng)

units = c("millisecond", "second", "minute", "hour", "day",
"week", "month", "quarter", "year")
x$match = lapply(seq_len(nrow(x)), function(ii)
agrep('second', units, value = TRUE, costs = x[ii, ]))

x$match_which = sapply(x$match, paste, collapse = '|')

sort(table(x$match_which))
# millisecond|second|minute|hour|week|month|year
# 57
# millisecond|second|minute|hour|week|month|quarter|year
# 13276
# millisecond|second|month
# 23316
# millisecond|second|minute|month|quarter
# 37842
# millisecond|second|minute|quarter
# 251480
# millisecond|second|minute|hour|day|week|month|quarter|year
# 409865
# millisecond|second
# 1035725


What am I missing here? Is there no way to accomplish my task (match seconds to second and not millisecond) with agrep?










share|improve this question
























  • I might be off, but does it help to do agrep("^second", ...) to make sure the matched pattern starts with "second"?

    – Lennyy
    Mar 27 at 6:26











  • @Lennyy could be... but would need fixed = FALSE to do regex matching... still not sure why it wouldn't work with fixed = TRUE

    – MichaelChirico
    Mar 27 at 8:40

















0















I'm trying to get agrep to match seconds to second and not millisecond, but there doesn't seem to be any value of costs to accomplish this.



I am especially confused that there's no value of the cost for deletions/insertions that seems to do the trick -- as I see it, second is one deletion from seconds whereas millisecond is one deletion and 5 insertions.



(warning that the lapply might take a while... you would get the same result for length.out = 10 and 0:10 much quicker)



rng = c(seq(0, 1, length.out = 20), 0:100)
x = expand.grid(insertions = rng, substitutions = rng, deletions = rng)

units = c("millisecond", "second", "minute", "hour", "day",
"week", "month", "quarter", "year")
x$match = lapply(seq_len(nrow(x)), function(ii)
agrep('second', units, value = TRUE, costs = x[ii, ]))

x$match_which = sapply(x$match, paste, collapse = '|')

sort(table(x$match_which))
# millisecond|second|minute|hour|week|month|year
# 57
# millisecond|second|minute|hour|week|month|quarter|year
# 13276
# millisecond|second|month
# 23316
# millisecond|second|minute|month|quarter
# 37842
# millisecond|second|minute|quarter
# 251480
# millisecond|second|minute|hour|day|week|month|quarter|year
# 409865
# millisecond|second
# 1035725


What am I missing here? Is there no way to accomplish my task (match seconds to second and not millisecond) with agrep?










share|improve this question
























  • I might be off, but does it help to do agrep("^second", ...) to make sure the matched pattern starts with "second"?

    – Lennyy
    Mar 27 at 6:26











  • @Lennyy could be... but would need fixed = FALSE to do regex matching... still not sure why it wouldn't work with fixed = TRUE

    – MichaelChirico
    Mar 27 at 8:40













0












0








0








I'm trying to get agrep to match seconds to second and not millisecond, but there doesn't seem to be any value of costs to accomplish this.



I am especially confused that there's no value of the cost for deletions/insertions that seems to do the trick -- as I see it, second is one deletion from seconds whereas millisecond is one deletion and 5 insertions.



(warning that the lapply might take a while... you would get the same result for length.out = 10 and 0:10 much quicker)



rng = c(seq(0, 1, length.out = 20), 0:100)
x = expand.grid(insertions = rng, substitutions = rng, deletions = rng)

units = c("millisecond", "second", "minute", "hour", "day",
"week", "month", "quarter", "year")
x$match = lapply(seq_len(nrow(x)), function(ii)
agrep('second', units, value = TRUE, costs = x[ii, ]))

x$match_which = sapply(x$match, paste, collapse = '|')

sort(table(x$match_which))
# millisecond|second|minute|hour|week|month|year
# 57
# millisecond|second|minute|hour|week|month|quarter|year
# 13276
# millisecond|second|month
# 23316
# millisecond|second|minute|month|quarter
# 37842
# millisecond|second|minute|quarter
# 251480
# millisecond|second|minute|hour|day|week|month|quarter|year
# 409865
# millisecond|second
# 1035725


What am I missing here? Is there no way to accomplish my task (match seconds to second and not millisecond) with agrep?










share|improve this question














I'm trying to get agrep to match seconds to second and not millisecond, but there doesn't seem to be any value of costs to accomplish this.



I am especially confused that there's no value of the cost for deletions/insertions that seems to do the trick -- as I see it, second is one deletion from seconds whereas millisecond is one deletion and 5 insertions.



(warning that the lapply might take a while... you would get the same result for length.out = 10 and 0:10 much quicker)



rng = c(seq(0, 1, length.out = 20), 0:100)
x = expand.grid(insertions = rng, substitutions = rng, deletions = rng)

units = c("millisecond", "second", "minute", "hour", "day",
"week", "month", "quarter", "year")
x$match = lapply(seq_len(nrow(x)), function(ii)
agrep('second', units, value = TRUE, costs = x[ii, ]))

x$match_which = sapply(x$match, paste, collapse = '|')

sort(table(x$match_which))
# millisecond|second|minute|hour|week|month|year
# 57
# millisecond|second|minute|hour|week|month|quarter|year
# 13276
# millisecond|second|month
# 23316
# millisecond|second|minute|month|quarter
# 37842
# millisecond|second|minute|quarter
# 251480
# millisecond|second|minute|hour|day|week|month|quarter|year
# 409865
# millisecond|second
# 1035725


What am I missing here? Is there no way to accomplish my task (match seconds to second and not millisecond) with agrep?







r agrep






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 6:02









MichaelChiricoMichaelChirico

21.7k8 gold badges66 silver badges126 bronze badges




21.7k8 gold badges66 silver badges126 bronze badges















  • I might be off, but does it help to do agrep("^second", ...) to make sure the matched pattern starts with "second"?

    – Lennyy
    Mar 27 at 6:26











  • @Lennyy could be... but would need fixed = FALSE to do regex matching... still not sure why it wouldn't work with fixed = TRUE

    – MichaelChirico
    Mar 27 at 8:40

















  • I might be off, but does it help to do agrep("^second", ...) to make sure the matched pattern starts with "second"?

    – Lennyy
    Mar 27 at 6:26











  • @Lennyy could be... but would need fixed = FALSE to do regex matching... still not sure why it wouldn't work with fixed = TRUE

    – MichaelChirico
    Mar 27 at 8:40
















I might be off, but does it help to do agrep("^second", ...) to make sure the matched pattern starts with "second"?

– Lennyy
Mar 27 at 6:26





I might be off, but does it help to do agrep("^second", ...) to make sure the matched pattern starts with "second"?

– Lennyy
Mar 27 at 6:26













@Lennyy could be... but would need fixed = FALSE to do regex matching... still not sure why it wouldn't work with fixed = TRUE

– MichaelChirico
Mar 27 at 8:40





@Lennyy could be... but would need fixed = FALSE to do regex matching... still not sure why it wouldn't work with fixed = TRUE

– MichaelChirico
Mar 27 at 8:40












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55370732%2fagrep-insists-on-matching-millisecond-and-not-just-second%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55370732%2fagrep-insists-on-matching-millisecond-and-not-just-second%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현