Creating Tag

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating Tag

hemantsain55
i want to tag categories to its menuname.
i have a csv containing menu item name and in other csv i have a column
containing some strings,
i want to pick that strings from categories and look into  menu items if
any menu item containing that string i want to create a new column next to
menu item name flagged as 1 otherwise 0
and the only condition is once a menu item flagged as 1 i don't need to
consider that menu item again to tag further in case of redundant strings
in categories only i want to search which are flagged as 0.
please help me with the R script.

*Menu Name*
9\ bobbie"
9\ chz steak"
9\ tuna"
provolone
20\ bobbie"
bottled soda 20oz
cran-slam ww
american
small chips
medium drink
9\ meatball"
capriotti's water
20'' chicken cheese steak
9\ veg turkey"
medium chips
9\ capastrami"
12\ bobbie"
12'' chicken cheese steak
cookie
12\ chz steak"
9\ cole turkey"
kid grilled cheese white
12\ italian"
12\ meatball"
12\ capastrami"
turkey sand w
20\ slaw be jo"
swiss
12\ cole turkey"
large drink
9\ ham&chz"
9'' chicken cheese steak
9\ slaw be jo"
turkey sand ww
stuffing
12\ turkey"
9\ italian"
12\ slaw be jo"
9\ grld italian"
12\ veg burger w/chz"
extra american
black&bleu salad
9\ turkey"
20\ turkey"
20\ capastrami"
ham sand w
12\ mushroom"
12\ grld italia"
italian salad
tuna sand ww
9\ roast beef"
20\ chz steak"
20\ mushroom"
9\ veg chzstk"
ham
genoa
12\ veg turkey"
12\ veggie cole turkey"
9\ mushroom"
cap's creation
mushrooms
salad chicken
20\ cole turkey"
1 pack chicken
kr  veg burger w/chz
12\ roast beef"
kid turkey n cheese white
20\ italian"
12\ ham&chz"
9\ employee sub"
roast beef kr
9\ veggie cole turkey"
12\ sausage"
tea
turkey sand kr
salad turkey
tuna sand kr
brownie
slice american cheese
1 oz pastrami
9\ cheese"
12\ italian up"
12\ capastrami up"
1 pack steak
delaware's finest small
the sampler sm
side ranch dressing
12\ veg turkey up"
20\ roast beef"
roast beef w
1oz turkey
12\ tuna"
20\ veg turkey"
12\ veg chzstk"
9\ sausage"
kid ham n cheese white
side italian dressing
salad provolone
20\ grld italia"
sample item 6
sample item 9
turkey
12\ slaw be jo up"
12\ meatball up"
1 oz roast beef
ham sand ww
delaware's finest large
side cole slaw large
large chips
20\ meatball"
12'' chick cheese stk up
12\ chz steak up"
12\ grld italia up"
cran-slam w
12\ bobbie up"
20\ cheese"
slice provolone
the sampler lg
meatball bar
slice ham
wise large chips
small side
sm soup
12\ tuna up"
12\ cole turkey up"
prosciutini
20\ veggie cole turkey"
soup
roast beef
20\ italian up"
20'' chick cheese stk up
20\ chz steak up"
20\ bobbie up"
20\ veg turkey up"
slice swiss
20\ capastrami up"
sample item 7
12\ ham&chz up"
salad swiss
12\ veggie cheese stk up"
california omelet
orange juice
exteme bac boy
dinner salad
chef salad
12\ turkey up"
the big cheese
combo it
fries cmb
sm pepsi
km cheese burger
#NAME?
#NAME?
kid grilled cheese wheat
kids ham cheese white box
calif. blt
bacon turkey melt
coffee
1-pc pancake
fries
tuna sand
biscuits & gravy
s-1/3 patty
x avocado
x chez
s-bacon
#NAME?
xtra egg
lg bev upcharge
sm ice tea
small soup
roast beef ww
salad tuna
med pepsi
20\ veg chzstk up"
day nm egg san
s-chkn brest
bell pepper
fruit
1 slice veggie turkey
s-toast
x sausage
1 pack sausage
chicken salad
lg pepsi
x dressing
large side
9\ firecracker turkey"
20\ sausage up"
20\ turkey up"
20\ veg chzstk"
lg ice tea
12\ roast beef up"
sample item 8
catering cap creation sal
the turkey lover sm
little italy sm
cookie tray
sd chk avo san
sm fry / 2 pc zucch
kid turkey n cheese wheat
junior chz burger
extra italian meat
chili chz fries
sm fry / 2 pc o ring
extra turkey








*CATEGORIES*
non-veg
chix
salmon
ch
chkn
brisket
brskt
bacon
bcn
chse
mahi
dog
shk
clam
parmesan
asiago
prosciutto
prosciutti
salami
Angus
hicken
chk
chick
wings
prk
pork
ham
bacon
ribs
fish
shrimp
tuna
beef
steak
stk
meatball

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

cat.txt (438 bytes) Download Attachment
menu name.txt (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Creating Tag

Ulrik Stervbo-2
Hi Hermant,

It sounds lile grep from base or str_detect from the Stringr package is
what you want.

Best,
Ulrik

Hemant Sain <[hidden email]> schrieb am Mi., 1. Nov. 2017, 08:31:

> i want to tag categories to its menuname.
> i have a csv containing menu item name and in other csv i have a column
> containing some strings,
> i want to pick that strings from categories and look into  menu items if
> any menu item containing that string i want to create a new column next to
> menu item name flagged as 1 otherwise 0
> and the only condition is once a menu item flagged as 1 i don't need to
> consider that menu item again to tag further in case of redundant strings
> in categories only i want to search which are flagged as 0.
> please help me with the R script.
>
> *Menu Name*
> 9\ bobbie"
> 9\ chz steak"
> 9\ tuna"
> provolone
> 20\ bobbie"
> bottled soda 20oz
> cran-slam ww
> american
> small chips
> medium drink
> 9\ meatball"
> capriotti's water
> 20'' chicken cheese steak
> 9\ veg turkey"
> medium chips
> 9\ capastrami"
> 12\ bobbie"
> 12'' chicken cheese steak
> cookie
> 12\ chz steak"
> 9\ cole turkey"
> kid grilled cheese white
> 12\ italian"
> 12\ meatball"
> 12\ capastrami"
> turkey sand w
> 20\ slaw be jo"
> swiss
> 12\ cole turkey"
> large drink
> 9\ ham&chz"
> 9'' chicken cheese steak
> 9\ slaw be jo"
> turkey sand ww
> stuffing
> 12\ turkey"
> 9\ italian"
> 12\ slaw be jo"
> 9\ grld italian"
> 12\ veg burger w/chz"
> extra american
> black&bleu salad
> 9\ turkey"
> 20\ turkey"
> 20\ capastrami"
> ham sand w
> 12\ mushroom"
> 12\ grld italia"
> italian salad
> tuna sand ww
> 9\ roast beef"
> 20\ chz steak"
> 20\ mushroom"
> 9\ veg chzstk"
> ham
> genoa
> 12\ veg turkey"
> 12\ veggie cole turkey"
> 9\ mushroom"
> cap's creation
> mushrooms
> salad chicken
> 20\ cole turkey"
> 1 pack chicken
> kr  veg burger w/chz
> 12\ roast beef"
> kid turkey n cheese white
> 20\ italian"
> 12\ ham&chz"
> 9\ employee sub"
> roast beef kr
> 9\ veggie cole turkey"
> 12\ sausage"
> tea
> turkey sand kr
> salad turkey
> tuna sand kr
> brownie
> slice american cheese
> 1 oz pastrami
> 9\ cheese"
> 12\ italian up"
> 12\ capastrami up"
> 1 pack steak
> delaware's finest small
> the sampler sm
> side ranch dressing
> 12\ veg turkey up"
> 20\ roast beef"
> roast beef w
> 1oz turkey
> 12\ tuna"
> 20\ veg turkey"
> 12\ veg chzstk"
> 9\ sausage"
> kid ham n cheese white
> side italian dressing
> salad provolone
> 20\ grld italia"
> sample item 6
> sample item 9
> turkey
> 12\ slaw be jo up"
> 12\ meatball up"
> 1 oz roast beef
> ham sand ww
> delaware's finest large
> side cole slaw large
> large chips
> 20\ meatball"
> 12'' chick cheese stk up
> 12\ chz steak up"
> 12\ grld italia up"
> cran-slam w
> 12\ bobbie up"
> 20\ cheese"
> slice provolone
> the sampler lg
> meatball bar
> slice ham
> wise large chips
> small side
> sm soup
> 12\ tuna up"
> 12\ cole turkey up"
> prosciutini
> 20\ veggie cole turkey"
> soup
> roast beef
> 20\ italian up"
> 20'' chick cheese stk up
> 20\ chz steak up"
> 20\ bobbie up"
> 20\ veg turkey up"
> slice swiss
> 20\ capastrami up"
> sample item 7
> 12\ ham&chz up"
> salad swiss
> 12\ veggie cheese stk up"
> california omelet
> orange juice
> exteme bac boy
> dinner salad
> chef salad
> 12\ turkey up"
> the big cheese
> combo it
> fries cmb
> sm pepsi
> km cheese burger
> #NAME?
> #NAME?
> kid grilled cheese wheat
> kids ham cheese white box
> calif. blt
> bacon turkey melt
> coffee
> 1-pc pancake
> fries
> tuna sand
> biscuits & gravy
> s-1/3 patty
> x avocado
> x chez
> s-bacon
> #NAME?
> xtra egg
> lg bev upcharge
> sm ice tea
> small soup
> roast beef ww
> salad tuna
> med pepsi
> 20\ veg chzstk up"
> day nm egg san
> s-chkn brest
> bell pepper
> fruit
> 1 slice veggie turkey
> s-toast
> x sausage
> 1 pack sausage
> chicken salad
> lg pepsi
> x dressing
> large side
> 9\ firecracker turkey"
> 20\ sausage up"
> 20\ turkey up"
> 20\ veg chzstk"
> lg ice tea
> 12\ roast beef up"
> sample item 8
> catering cap creation sal
> the turkey lover sm
> little italy sm
> cookie tray
> sd chk avo san
> sm fry / 2 pc zucch
> kid turkey n cheese wheat
> junior chz burger
> extra italian meat
> chili chz fries
> sm fry / 2 pc o ring
> extra turkey
>
>
>
>
>
>
>
>
> *CATEGORIES*
> non-veg
> chix
> salmon
> ch
> chkn
> brisket
> brskt
> bacon
> bcn
> chse
> mahi
> dog
> shk
> clam
> parmesan
> asiago
> prosciutto
> prosciutti
> salami
> Angus
> hicken
> chk
> chick
> wings
> prk
> pork
> ham
> bacon
> ribs
> fish
> shrimp
> tuna
> beef
> steak
> stk
> meatball
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.