There are few people who choose UK to work due to the language (english is the most used language) Specially in Spain because the proximity and the language studied in the school the adventure you should choose a place where begin to search. Since my point of view the better town is London for multiple factors:
However it is not good all it seems to be like, there are the next disadvantages:
First you will have attention to work is having the number NIN (national isurance number) to be registered by the uk governement.
With that you could begin to accept jobs, and because is european country they will accept without a problem.
To get that you will ask for a appointment by phone where they will ask a serie of questions as your number phone and home address. It is important in this kind of interview because if not
you will not get the appointment and the NIN, and having a home address, depending of where you live there will correspond you jobcenter u other.
Normally the appointment is about two weeks to ask it, and once you have a NIN doing the papers to sign will be easier.
If you look for a good job, it could be done this kind of papers by the company you have applied.
It is neccesary have experience in UK and therefore have more options to have a better job.
Unfortunetly, most of the cases are not payed but sometimes the company pay life expenses like food and transport.
In this time that normally is about six months you will live not in the conditions you probably expect but you will have a good knowledge about how is work in england.
However you will improve your tecnical english and establish contacts than could give you the link to go to other companies with a better contract.
Some interesting links:
This browsers will help you to see the different offers and specially the range of salaries where will be allocated your future job and the common places where there are located. If you are thinking about do the search in your country, to save expenses, I recommend you to get a british english SIM and change your home address for a british address. They appreciate a lot the sooner availability and people who are proactive to move a country to find a job right there better than people than are waiting for the job come to them.
If you have a superior titulation and experience looking for a job in UK will be easy.
Although not having experience in UK your first job will give you a salary below the average in most of the cases.
Once you have been working for one year, you could have the option to apply for better jobs and conditions.
Normally if you are registered in multiple sites and you have experience there even if you are not doing an effort to look for the job.
If you have updated your profile you will receive a lot of offers and if you look some interest you will have the possibility to choose between different jobs.
There are a big quantity of job offers and frequently it is hard for the recruiters to find it because most of the people with a profile like than are already working.
When I ended my job in UK at my first job for reasons outside the worker, a movement country for the project and the recruiters know about the company will do that i received a lot of calls even the same day to have different jobs of recruiters interested.
With the little agencies you could speak more relaxed and you should have a personal recruiters list each time you are thinking of change of job.
Because of the market there is very dinamic even if it was your problem be fired that is not very relecant for the recruiters.
They will explain different motivations to change the job and grace to they have spoken a lot with the companies they try to hire for it will be easier than you contact directly.
In addition, normally the money they receive the recruiters it is specific and this is not along with the time like in other european countries than it seem the agency is keep part of your salary forever
Here is show a big range of little agencies to have a close contact with them. Having the possibility to know exactly what you are looking for and having the possibility to keep the contact for future offers or situations.
© 2016 - All Rights Reserved - Diseñada por Sergio López Martínez
El sitio se mantiene gracias a la publicidad, por favor Desactiva Adblock para seguir navegando
He desactivado Adblock


THE GLASS SHIELD A film review by James Berardinelli Copyright 1995 James Berardinelli
RATING (0 TO 10): 6.7
U.S. Availability: wide release 6/2/95 Running Length: 2:15 MPAA Classification: PG-13 (Profanity, mature themes) Theatrical Aspect Ratio: 1.85:1
Cast: Michael Boatman, Lori Petty, Ice Cube, Michael Ironside, Don Harvey, Richard Anderson, Bernie Casey, Elliot Gould, M. Emmett Walsh, Victoria Dillard Director: Charles Burnett Producers: Carolyn Schroeder and Thomas Byrnes Screenplay: Charles Burnett Cinematography: Elliot Davis Music: Stephen James Taylor U.S. Distributor: Miramax Films
Charles Burnett's THE GLASS SHIELD opens with a clever conceit: comic book panels displaying the bravery and heroism of cops. That's a mindset which J.J. Johnson (Michael Boatman) buys into with all his heart and mind. Since childhood, he's wanted to be a policeman and, following his recent graduation from the academy and subsequent assignment to the Los Angeles County Sheriff's Department, he sees himself on the streets, righting wrongs and bringing evil-doers to justice.
J.J.'s first encounter with reality occurs when it becomes clear that his new place of employment is less concerned about meting out justice than maintaining an "old boys' network". Headed by the seemingly-affable Clarence Massey (played by grandfatherly Richard Anderson, best known as Oscar Goldman from the 70s hit THE SIX MILLION DOLLAR MAN), the department bubbles with intolerance from the likes of detectives Baker (Michael Ironside) and Hall (M. Emmett Walsh). The hatred isn't exclusively directed at J.J., however. Also in the line of fire is Deborah Fields (Lori Petty), who happens not only to be a woman, but a Jew as well.
Nevertheless, despite all the cold shoulders and deliberate snubs, J.J. is determined to stick it out, unwilling to let go of his glorious image of what it means to be a cop. So, when an apparent murderer (played by Ice Cube) is captured, J.J. is all-too-willing to lie on the witness stand to help put the man away. Then he discovers that he's not the only one guilty of perjury -- in fact, truth is a rare commodity in this trial.
Burnett, the director of TO SLEEP WITH ANGER and KILLER OF SHEEP, paints a bleak and disturbing picture of corruption and prejudice, basing his script on several real cases. The storyline is a bit convoluted, but it never gets so confused that the primary themes become obscured. This is a cop movie that concentrates on drama instead of action -- there's not a car chase to be seen. Burnett has chosen to focus on racism, shattered naivete, and the tough decisions that come with being caught in the middle. J.J.'s fight against the system becomes a struggle for his own identity and humanity.
One of the problems with THE GLASS SHIELD is that it settles for stock villains. Despite a series of competent performances by the likes of Richard Anderson, Michael Ironside, and M. Emmett Walsh, the bad guys here are pretty much one-dimensional from start to finish. This lack of character depth blunts the film's impact. With the exception of the two protagonists and one token veteran officer, every cop is like the next: nasty, crude, and bigoted. Positive characteristics are definitely at a premium in the L.A. County Sheriff's Department.
Burnett's screenplay has a tendency to be a little too preachy, especially during the unsatisfying final scene. There's a fine line between getting the message across through subtlety and becoming didactic, and THE GLASS SHIELD occasionally strays across it. Despite this, however, the film clearly has something worthwhile to say, and does so in a manner that, while not ground-breaking, is at least engaging. There just should have been a little more gray amidst the black-and-white.
- James Berardinelli<EMAIL_ADDRESS>The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Dear Sir, I am Mr.Joseph Bako,CEO of SOUTHERN TRADE INTERNATIONAL INC..We are a company that deals on raw materials and export into the Canada/America and Europe. We basically deal in raw materials for the manufacture of rugs,tiles,carpets and marbles.Right now we are offloading our core investments in Asia as we were greatly affected by the recent Tsunami Disaster. So we are paying off our Customers overseas as well as collecting money from some of them who owe us outstanding sums. We are searching for representatives who can help us establish a medium of getting to our numerous clients in the Canada/America and Europe as well as making payments through you to us. Should you be ready to work with us, you would serve a middle man for this venture,we have customers in Europe, Canada and America.what you will do is collect funds from Buyers and then you will be required to pay our Creditors in Europe and else where. For a start we will be glad and happy to give you 5% per each transaction as our representative in Canada/America and Europe. The only requirement is that you must have a sound line of credit. Please if you are interested forward to us your resume with phone number/fax and your full contact addresses thro scanned email attachment. Yours sincerely Joseph Bako Chief Excutive Officer SOUTHERN TRADE INTERNATIONAL INC.


Huddle re-imagines the way we build communities. You have a voice, but so does your audience. Create connections with your users as you engage in genuine discussion.
Communities Formed
Messages Sent
Generate meaningful discussions with your audience and build a loyal strong community. Think of the insightful conversations you miss out on with a feedback form.
You would'nt paginate a conversation in real life, so why do it online. Our threads have just in time loading for a more natural flow
It takes no time at all to integrate Huddle with your app's authentication solution. This means, once signed in to your app users can start chatting immediately.


JSnake Online
Connect to Server
Connect
connecting...
Error
Room
@
Exit
Players
(You)
Ready
Not Ready
Ready !
Not ready
no player
Let's Play Game


HOME
ABOUT
PROJECTS
SUPPORT
CAREPLUS
CONTACT
Projects
ALL
/
CARE
/
CARE+
/
HOSPITAL
Full Image
sample
Lorem ipsum
Full Image
sample
Lorem ipsum
Full Image
sample
Lorem ipsum
Full Image
sample
Lorem ipsum
Full Image
sample
Lorem ipsum
Full Image
sample
Lorem ipsum


Yu’ebao is China’s first ever Internet fund specially designed for Alipay.
It remains the largest money market fund in China, known in full as Tianhong Yu’ebao Money Market Fund.
Putting security and liquidity first, the company delves into the economic and policy climates, market status, and money supply and demand, and designs and adjusts portfolios based on stringent risk control to bring in impressive returns for investors.
In May 2013, the first Internet fund product was launched in China.
The first of its kind, Yu’ebao is specially designed for Alipay.
It is a mutual fund covering the most individual clients in China, with more than 260 million subscribers as at June 30, 2016.
It is the largest money market fund in China by assets under management whose worth stands at RMB 816.3 billion.
Easy to operate, low barrier to entry, free of charge, and withdrawable anytime.
Apart from the function of wealth management, Yu’ebao, as a cash management tool in the mobile Internet era, can also be directly used in shopping, transfers, bill payments and other consumption payments.
Full coverage by ZhongAn Insurance.
7-day annualized rate of return (September 1, 2016): 2.313%*(source: Tianhong Asset).
With an initial investment threshold of RMB 1 and increments of RMB 0.01, it can be used for online consumption or withdrawal.
As the manager of Yu'ebao, THFund opened a new chapter in internet finance.
Relying on Yu'ebao, THFund has enhanced its management ability. For example:
A leading alternative counterparty library in the whole market, including 20 head offices and more than 200 branches.
An innovative negotiated deposit quotation system in the whole market that is open and transparent and improve efficiency significantly.
Excellent liquidity management in the whole market, relying the big data team to accurately predict subscription and redemption amount.
Leading transaction processing capability in the whole market, with a daily transaction value of RMB5 billion-RMB10 billion, which has high requirements on the internal and external synergy. Strict risk control in the whole process of management by white list system.


Contact Form JS Validation
Please fill out this form to contact us
How Did You Hear About Us
Google
Friend
Advertisment
Other
What Is The Best Way to Reach You?
Email
Phone Call
Snail Mail


--- { "atomic": "molecule", "dna": ["progress", "progress-bar", "progress-bar-striped", "progress-bar-animated"] } ---


Terms & Conditions
By downloading or using the app, these terms will automatically apply to you – you should make sure therefore that you read them carefully before using the app. You’re not allowed to copy, or modify the app, any part of the app, or our trademarks in any way. You’re not allowed to attempt to extract the source code of the app, and you also shouldn’t try to translate the app into other languages, or make derivative versions. The app itself, and all the trade marks, copyright, database rights and other intellectual property rights related to it, still belong to Seanghay Yath.
Seanghay Yath is committed to ensuring that the app is as useful and efficient as possible. For that reason, we reserve the right to make changes to the app or to charge for its services, at any time and for any reason. We will never charge you for the app or its services without making it very clear to you exactly what you’re paying for.
The Khmer Vehicle Scanner app stores and processes personal data that you have provided to us, in order to provide my Service. It’s your responsibility to keep your phone and access to the app secure. We therefore recommend that you do not jailbreak or root your phone, which is the process of removing software restrictions and limitations imposed by the official operating system of your device. It could make your phone vulnerable to malware/viruses/malicious programs, compromise your phone’s security features and it could mean that the Khmer Vehicle Scanner app won’t work properly or at all.
You should be aware that there are certain things that Seanghay Yath will not take responsibility for. Certain functions of the app will require the app to have an active internet connection. The connection can be Wi-Fi, or provided by your mobile network provider, but Seanghay Yath cannot take responsibility for the app not working at full functionality if you don’t have access to Wi-Fi, and you don’t have any of your data allowance left.
If you’re using the app outside of an area with Wi-Fi, you should remember that your terms of the agreement with your mobile network provider will still apply. As a result, you may be charged by your mobile provider for the cost of data for the duration of the connection while accessing the app, or other third party charges. In using the app, you’re accepting responsibility for any such charges, including roaming data charges if you use the app outside of your home territory (i.e. region or country) without turning off data roaming. If you are not the bill payer for the device on which you’re using the app, please be aware that we assume that you have received permission from the bill payer for using the app.
Along the same lines, Seanghay Yath cannot always take responsibility for the way you use the app i.e. You need to make sure that your device stays charged – if it runs out of battery and you can’t turn it on to avail the Service, Seanghay Yath cannot accept responsibility.
With respect to Seanghay Yath’s responsibility for your use of the app, when you’re using the app, it’s important to bear in mind that although we endeavour to ensure that it is updated and correct at all times, we do rely on third parties to provide information to us so that we can make it available to you. Seanghay Yath accepts no liability for any loss, direct or indirect, you experience as a result of relying wholly on this functionality of the app.
At some point, we may wish to update the app. The app is currently available on Android – the requirements for system (and for any additional systems we decide to extend the availability of the app to) may change, and you’ll need to download the updates if you want to keep using the app. Seanghay Yath does not promise that it will always update the app so that it is relevant to you and/or works with the Android version that you have installed on your device. However, you promise to always accept updates to the application when offered to you, We may also wish to stop providing the app, and may terminate use of it at any time without giving notice of termination to you. Unless we tell you otherwise, upon any termination, (a) the rights and licenses granted to you in these terms will end; (b) you must stop using the app, and (if needed) delete it from your device.
Changes to This Terms and Conditions
I may update our Terms and Conditions from time to time. Thus, you are advised to review this page periodically for any changes. I will notify you of any changes by posting the new Terms and Conditions on this page. These changes are effective immediately after they are posted on this page.
Contact Us
If you have any questions or suggestions about my Terms and Conditions, do not hesitate to contact me at seanghay.dev@gmail.com.


Before Change
prediction=predicted_answer,
is_regex=False)
predictions_file.write(
json.dumps(
dict(
question=question,
prediction=predicted_answer,
predicted_context=six.ensure_text(
predictions["orig_block"], errors="ignore"),
correct=is_correct,
answer=answers)))
predictions_file.write("\n")
correct_count += int(is_correct)
example_count += 1
After Change
correct_count += int(is_correct)
example_count += 1
if FLAGS.print_prediction_samples and i & (i - 1) == 0:
logging.info("[%d] "%s" -> "%s"", i, question, predicted_answer)
logging.info("Accuracy: %.4f (%d/%d)", correct_count / float(example_count),
correct_count, example_count)


---
layout: default
title: Frequently Asked Questions
---
Frequently Asked Questions
What is the Lightning Network?
Before you start using Blixt Wallet, it's important to get familiarized with terms, procedures, features, etc.
It's a good idea to start reading and get some basic knowledge about LN and how to use it, otherwise it will be
difficult for you, as a new user, to understand what you are doing with Blixt Wallet as a node LN wallet.
Here are some resources to start learning:
A. General information and documentation about the Bitcoin Lightning Network
-
The Lightning Network and the airport analogy
-
An Overview of Lightning Network Implementations
-
Lightning Network Resources, complete library about LN - by Jamesson Lopp
-
Daily spending wallet, guide about using a Bitcoin and LN wallet - by Bitcoin Design
-
LND Documentation - by Lightning Engineering
-
Lightning Node Management – by openoms
-
Lightning Node Management in Español – by openoms
-
Beginners LN Guide – by Bitcoin Q&A
-
Lightning Network Dev Curriculum – by Chaincode Labs
-
The Lightning Book – by Rene Pickhardt, Olaoluwa Osuntokun and Andreas M. Antonopoulos
-
⚡ Lightning Network is awesome ⚡ - collection of all kind of things you can do with LN
B. Video tutorials about the Lightning Network and Bitcoin nodes
-
What is a Bitcoin node
-
The Lightning Network: The most efficient payment system in the world
-
How LN channels work – by Decentralized Thought
-
LN explained – by René Pickhardt
-
LN Channels Management – by Alex Bosworth
-
Everything you need to know about LN – Till Musshoff
Blixt doesn't sync. Why is this and what can I do?
First of all, let's explain some reasons for WHY it is not syncing, so the user can understand the situation:
- The Blixt app needs to be online (connected to the internet) in order to connect to the Neutrino node and sync
the block headers and filters. If your device, for some reason, is not connected to a stable internet
connection, Blixt will stall the sync until it is restarted.
- If you use the Tor network, the connection is quite unstable sometimes, not because of your device but because
of poor or congested Tor relays in your area.
- Keep in mind that Blixt uses quite a good amount of storage on your device, up to 2GB, so be
sure to have enough free space, otherwise the app will stop the sync.
- Sometimes the sync was not done properly and the app didn't scan all your BTC addresses.
- If you switched to sync with your own home node, maybe your node was not prepared for this or connection with
your node was interrupted.
So what you can do?
- Restart the Blixt app (try force close for closing bad connections).
- Remove Tor connection (if is possible and you want it) and restart Blixt.
- Switch between your internet connections (Wifi <-> 4G). That could trigger a refresh of DNS providers in your device.
- Switch back to default sync server node.blixtwallet.com, or just leave it blank.
- Optional you can use an alternative Neutrino Node node.eldamar.icu or your own node if you run one.
- Go to Settings -> Rescan wallet, then restart the app. Once restarted, go to Settings -> Read lnd
log, or go to Settings -> Copy lnd log to local storage to save a copy of the lnd log.
- Check if you have enough space on your device. Move apps, photos, and videos to your mSD card, and leave more
space on the local disk. Blixt needs up to 1.5GB for its data (block headers, LN graph, channels.db, etc).
- Restart the app, then go to Settings -> LndMobile Help Center, and run a diagnostics test. Get in
contact with Blixt support on Telegram for further
instructions or to share logs.
What are the fees? Is there a cost to use LN channels?
1. Blixt Wallet itself does not charge any fees for usage of the app.
2. Use of the Lightning Network (LN) is not free! This is a myth. Even if the cost of using LN is really
small, there is a cost, and some users will look at that cost too.
3. Opening and closing channels on LN has a cost, and sometimes it's not cheap. It also depends on the
current miner fees when opening a LN channel. Sometimes it can be really high, sometimes it can be really low.
Users should first learn about how fees work. To learn more about mempool, users can read What is
Mempool?. To learn more about LN fees, users can read Lightning 101: Lightning Network Fees.
 You have no funds deposited into the
wallet.
Let's say you choose to use the Dunder LSP service (see down below how Dunder LSP works and
what is LSP) to deposit 100k sats into your Blixt LN wallet.
The moment the LSP service receives your 100k deposit, it will use those 100k sats to open a 400k sats channel
(amount can vary, see here for more details) towards your wallet. You will have 100k sats as
outbound liquidity and 300k sats as inbound liquidity, but that opening comes at a cost: on-chain fees for the tx
as well as a commit fee (reserve held for channel closure). More information on committing fees can be found in
the following links:
What is the channel reserve?
"I have opened a 500k sats channel, but I can't use more than 495k sats, it says insuficient balance. Why is that?"
Another aspect to take in consideration is the "channel reserve". If you go to your Blixt - top drawer - Lightning Channels
you will see in the channel details that is mentioned how much is the channel reserve.
A channel reserve is an amount that is set aside by each channel participant which ensures neither have "nothing at stake"
if a cheating attempt occurs.
This reserve (usually 1% of the total amount of the channel) cannot be spent, and is held aside for the entirety of the channels lifetime.
Channel reserves make cheating attempts less economical. When one channel party attempts to cheat the other and they are caught,
a penalty transaction can be used to steal all the cheating parties bitcoin as punishment.
Channel reserves makes it so cheating attempts always have something at stake making this less likely to occur.
Read more about LN channel reserve here.
With which nodes can I open lightning channels?
REMEMBER:
- Blixt Wallet uses private channels, not routing channels.
- You can open channels with whatever node peer you choose, but choose wisely.
- Blixt Wallet is a private node wallet and mostly for quick payments. You will need to find the best routes:
cheap, fast, reliable, and well connected peers.
- You can connect to your own home node, but keep in mind that at that moment, your home node will be the
liquidity provider for your wallet, so make sure it's reliable and you have good routes and good fees.
- Not every LN node wants or agrees with private channels. If it is a dedicated routing node, they usually do
not want private channels because for them it is like "locked" liquidity. It is better if you can first ask the
node operator if they will agree to a private channel. You can open directly, but be aware that some of them can
close the channel because they do not want private channels.
Blixt Wallet itself offers two optional methods for opening channels with the Blixt Node Server:
- Autopilot: at the moment, it works only for the first
on-chain deposit in Blixt and will open a channel with the Blixt Node for the amount you deposited.
- Dunder LSP: Blixt Node Server will provide you
with an inbound channel until 400k sats, on top of your deposit amount, to start with your first deposit on
Lightning (if you do not have any other channel). You will need to activate it in the Settings menu.
Inbound liquidity providers - Blixt also offers a direct link, in the wallet, to LNBig and Bitrefill (Thor). Go
to Settings -> Inbound channel services. Select the desired one, and follow the instructions provided.
Those are used only when you need more "INBOUND" liquidity.
Open channels with any other good nodes -
Blixt Community recommended peers
is a good source to inspire from other Blixt users. As we've pointed out, we recommend choosing your peers wisely.
Blixt is a quick-spending LN wallet. We recommend finding one with low fees or even zero fees. Also, look at this Amboss Community
of Zero Base Fee or any other node community. Your Blixt Wallet needs good peers and low fees, so your
payments will be fast and cheap.
It is very good practice to open channels with merchants or services you pay frequently. Opening a channel with
your favorite merchant can bring you 0 fees since it is a direct channel and it is like a "line of credit." You
can also use that channel to pay other merchants or services. Just be aware of their fees for routing your
payment, because if there isn't a direct payment route, their node will have to route your payment to the next hop
until it reaches the destination, and that comes at a cost.
How is it possible to have a node on a mobile device?
Blixt Wallet uses the lightning node implementation lnd and the
Bitcoin SPV client Neutrino directly on the phone. Lnd has been configured to work well on mobile devices.
Keep in mind that Blixt Wallet is a Lightning node, with LN channels as any other node. That means that in order
to be able to transact on LN, you need to be online and connected at the moment of the transaction. If you do not
transact, it's not necessary to stay online. Blixt. Once Blixt is open, it will take a few moments to re-sync the
latest blocks through SPV Neutrino, and you will be back online. On the other hand, for transacting on-chain (not
LN), it's not necessary to be online.
Can I route payments with Blixt Wallet?
Blixt is not a routing node, it is more like a private LN node.
All channels on Blixt are private, which means they are not "visible" to the other routing nodes in the
network. These so-called "unannounced" channels are used only for private payments.
Your Blixt LN node can send and receive payments using other nodes as hops, but can not route other payments
through your Blixt node.
That's why Blixt is so special ... nobody knows about your payments. Check out this
short tutorial about LN onion routing.
Can I receive sats through keysend?
Yes, always when your Blixt Wallet is online.
To display your nodeURI/QR code, go to Menu -> Advanced -> Keysend Experiment. Have the payer scan that
QR code and pay.
Aspects to keep in mind:
- If you want to share your nodeID on a website or send it to someone so they can pay you via keysend, your
Blixt Wallet must be online at the time of the payment.
- If you, as receiver, are using a Tor connection, the payer also has to use a Tor connection, otherwise they
cannot "see" your Blixt node and connect with it.
How do I connect Blixt Wallet to my own full node?
Under Settings -> Bitcoin Node, you can enter a Bitcoin node to connect to.
BIP157 compact filter indexing must be enabled for your node. Add this to your bitcoin.conf if it isn't already set:
blockfilterindex=1
peerblockfilters=1
Also your Bitcoin node's port 8333 should be forwarded into your internet router.
Can I remotely control an Umbrel node from Blixt Wallet?
Blixt Wallet is a fully fledged lightning node in and of itself. It's not possible to connect to
and control a remote node like Umbrel, myNode, RaspiBlitz, etc. For that management task, you would need to use
apps like Zeus, Zap, Thunderhub, Ride The Lightning, or Fully Noded.
Instead of controlling your node from home, enable Tor and open a channel to it. That way, you could use your
Blixt Node Wallet as a companion for your home routing node. See more details on the Guides page.
I lost my mobile phone (dead, stolen) or simply want to migrate to a new phone. What is the procedure?
RULE NO.1 - You should always have a channel backup and keep it in a safe place (e.g., password manager). If you
did that, the procedure is simple and you have two ways (fast and slow) and also two situations to take into
consideration (whether you had funds in on-chain or not).
RULE NO.2 - Never use a full backup of a device as a restored backup for BTC/LN wallets. This can result in
losing funds by broadcasting the wrong state of channels.
NOTE NO.1 - Migration (or funds restore procedure) means creating a new Node ID and moving the restored funds to
it. This is a better procedure for privacy, safety of funds, and overall ease of use.
NOTE NO.2 - If you have the ORIGINAL DEVICE still working and online with funds in LN channels, NEVER do
the restore procedure on a new device with the channels restore options. This action will force close the existing
channels and you could get a penalty for that (broadcasting twice the status of channels). You can ONLY restore
the on-chain wallet/seed on another device, keeping the original still open, but never restore the channels
backup.
NOTE NO.3 - If, after starting the restore process, you do not see in the "Lightning Channels" menu that the old
channels have entered the status "closing," or if they are not there at all, it is safe to restart the restore
process from the backup file. There is no need to start over from zero with an on-chain restore. If your on-chain
wallet is restored and funds are back, it is OK to continue with LN channel restore.
NOTE NO.4 - If you restore LN channels that were open using the Tor network, then BEFORE starting the restore
process, go to Settings -> Enable Tor. That way, your Blixt node can "see" the Tor peers and start the
closing procedure in the normal way.
Scenario A - migrate Blixt to a new device (fast way)
Conditions:
- You still have the old device functional
- You have a new device ready with Blixt Wallet already installed (but not started yet)
- You have funds ONLY in LN channels, the on-chain is empty
Procedure:
-
Create a new Blixt wallet instance on the new device (new seed) and save that seed into a safe place (e.g.,
password
manager).
-
Wait for Blixt to sync (takes just a few minutes), you will see the sync icon on the top right disappear.
-
On the new device Settings -> Enable Dunder LSP.
-
On the new device, go to main screen and click on the Receive button to create a new LN invoice to open a
Dunder LSP channel.
-
Put the amount of total balance available displayed on the old device Blixt (main screen), then press
CREATE INVOICE.
-
With the old Blixt device, scan the LN invoice QR code and pay it. The old wallet will send all available funds
to the new one, and Dunder will open a new channel for you with that amount.
-
It will take a few minutes until the tx is confirmed and the channel is opened on the new device. Be patient.
-
Once you see the funds in the new device available, it is recommended to close those old empty channels. If
there are some residual satoshis, they will go back to the on-chain wallet and can be sent later to the new
device using an on-chain tx.
-
DONE! Blixt can now be deleted from the old device, and the funds are safe in the new one.
Scenario B - old device is lost, non-functional, or non-recoverable (slow way)
Conditions:
- You do not have the old device anymore
- You have a new device ready with Blixt Wallet already installed (but not started yet)
- You have funds in the LN channels but also in the on-chain wallet
Procedure:
-
Install Blixt Wallet on a new phone.
-
On the first screen to create or restore a wallet, go to Settings -> Enable Tor (if you previously
opened channels with Tor nodes). You have funds in the LN channels but also in the on-chain wallet.
-
Blixt will restart in Tor mode. Then click on "restore." Fill in your 24 word seed from your old wallet, space
delimited. You can also add the channels.backup file you saved previously and copy it onto your new phone.
Optionally, you can use Google Drive, if you have it there.
-
Click "restore" and wait for the app to perform the standard procedure for recovering the funds.
-
Blixt will close the existing channels and, after a few blocks, funds will be recovered and visible in
your on-chain wallet. Be patient.
-
To check the funds, go to Menu -> On-chain. Click the top right menu to see the Transaction Log. After
channels are closed and txs are confirmed, locktime expires. The funds are displayed here.
I restored my old node using the SCB file, but funds are not back in my on-chain wallet.
OK, I had a previous dead node and I used the restore procedure, using the SCB backup channels file into Blixt. I
wait for the channels to be closed, but funds are not back in my on-chain wallet. What can I do?
Usually, there are a few possible scenarios for closing channels:
-
A normal "cooperative close" channel usually takes a few blocks if both peers are online. Then everything goes
smooth and fast.
-
If the other channel peer is not online, the closure task takes effect. This could take at least 144 blocks
until funds are released from the lock time. Check the locktime for the closing tx on mempool.
-
A normal closure can be for many reasons, but mostly because of lost connectivity. If a normal closure gets
stuck, then once the rest of the channels have entered into a "waiting to close" state, you could repeat the
process to once again push the closure of the remaining stuck channels.
-
Another way to "push" the connection with your lost peers is to add them manually. Go to amboss.space, search for your peer,
copy or scan the QR URI of your peer, and go to Settings -> Show Lightning Peers -> + .
-
To try a force closing action again, go to Menu -> Lightning Channels. Select the channel you want to
push, and swipe on activity view to start the process again.
Once all the channels are initiated into "closing", wait patiently. This process takes time.
If you see that on mempool the tx has released the funds, check your on-chain wallet. If funds are still
not there, it means that the lnd wallet has to rescan previous addresses and refresh the wallet history. Some
UTXOs are linked to "anchor outputs," so they are more complicated to get back on-chain.
When you see that all channels are closed, go to Settings -> Rescan wallet. Activate it and restart the
app if it does not do so automatically.
Only when the lnd is initiated, can the rescan take place. Be patient and check the lnd logs (see Settings ->
Read lnd log). You will read in there how it is scanning many blocks at once for your restored addresses.
Once the process is finished, you should see the funds in the on-chain wallet.
Try to keep the Blixt app active during this process. If it is interrupted, you will have to restart again to
trigger it.
IMPORTANT NOTES TO CONSIDER (in regards of how LN funds are moved):
- When you open a channel of 2M sats with a peer, in the beginning, all the sats will be on YOUR side.
- You start moving these sats by making payments and/or routing others' payments through this channel.
- If you do not make your own payments out of your node, your balance will always be the same, but some channels
will move sats in and out.
- By routing others' payments, the dynamic of your channel's balances is changing. That is, if you started with
2M sats and routed 1M sats, your channel balance will be 1M sats. When you close that channel, you will get back
1M sats and NOT 2M sats that you had initially.
 That is the amount you will get back. Some channels will be empty on your side, so don't expect to get
sats from those closed channels.
I have one channel with my home node, but I get "no route found". What can I do?
In this case, having only one channel open with your own node, you will need to tweak a bit your node.
And we've found these options that will help your Blixt to "communicate" better with your home node.
Go to your home node lnd.conf file and add these lines:
at the end of [Application Options] section
numgraphsyncpeers=9
ignore-historical-gossip-filters=false
under [Routing] section
routing.strictgraphpruning=false
under [gossip] section (create it at the end if you do not have it)
gossip.max-channel-update-burst=20
gossip.channel-update-interval=1m
We always recommend to have more than one channel open and not just with the same peer, but with different peer nodes.
As we explain it in this section.
What would be the procedure to close channels with a peer node?
I have a channel with a peer node that I want to close it / peer announced that will shut down his node.
I would like to have the minimum impact possible over my remaining balance and pay minimum fees.
The simple answer is to have a "collaborative closing", so follow this procedure:
- Wait for Blixt to sync and also bring online your LN channels.
- Eventually check Blixt lnd logs in settings if all the sync is done.
- Check if your peer is connected. Go to Settings - Lightning peers and check if the peer with which one you want to close is online.
If is not, try to add it, by scanning his node URI.
- Go to Blixt top drawer - Lightning channels
- Select the channel you want to close and click on the red button "Close channel".
- Confirm the closing and wait with Blixt app active until you see the confirmation tx of the closing channel.
- It will take few moments to be closed, depending on the status of the mempool
- Once the closing tx will have 3 confirmations in the mempool, your remaining funds will be displayed in the on-chain wallet.
Done. This will close the channel with minimum costs in fees and also the channel reserve is returned to your onchain address.
If you want a "force close" of the channel, in case that the peer is already shut down, non-responsive,
then instead of a simple click on the red button, use a long press on the same button and then the popup message will contain the words
"Do you want to FORCE CLOSE this channel?" and will push the closure with a higher fee.
REMEMBER: this procedure will take more time to be confirmed, due to a lock time of the closing tx, in case are penalties to apply.
It could take up to 144 blocks, aproximately 2 weeks, but no more.
If for some reasons, the coop close is not done well (see if your txid is not broadcast in the mempool after long time),
then you could try to push a "force close" of the "waiting to close" status. This could happen sometimes, for various reasons.
Here is an example:
Once you hit the button "Force close pending channel" you will be asked if you are sure and then a message that it will start force close.
Be patient, after few moments, you will see in the lnd logs the message that the force close was inititated:
[INF] PEER: Waiting for confirmation of cooperative close of
ChannelPoint(6659e11bd3fc6f266c2e057545a7b4c8ec6e6dbc3579167e4346889af602b485:1)
with txid: ce3ed9c8396c8dda4085be8aef4eff4207562f7fdfb79413ab27b828789170ac
When the txid is taken in a block and you have the 1st confirmation, you will hear a jingle from Blixt app.
The closing is on the way, but be aware of the indicated maturity block height, is when actually you will receive the funds in onchain.
Usually are 144 blocks for force closing. That means aprox. 1 day.
Can I restore my Blixt wallet into another app?
Yes. Remember that Blixt is a full vanilla LND node wallet (aezeed).
What does it means that? Means that you can restore it in any other wallet app that support LND/aezeed type mnemonic seed.
Let's say you cannot install anymore Blixt app on your device. You could use the following procedures, to restore your funds from a Blixt wallet:
Simply put your Blixt 24 words seed into restore procedure, wait few moment to restore old UTXOs and done.
REMINDER: this is restoring ONLY onchain wallet, not also the LN channels!
This procedure is very well described in this excellent guide by openoms.
REMINDER: this is restoring ONLY onchain wallet, not also the LN channels!
The procedure is not complicated but require some steps:
- Go to Cryptography Toolkit and download the page as HTML file onto your computer.
- Open that HTML file in "offline mode" (no internet) and select "aezeed Cipher Seed Scheme" from Tools. Then go to the 2nd tab "Decode Mnemonic".
- Paste your 24 words into the "Mnemonic" field.
- Select format BIP84 native segwit and wait a bit to be decoded.
- Copy the zprv displayed into the field "HD node root base 58".
- Open (already downloaded) Sparrow wallet app and select "new wallet".
- In the "Keystores" select "new imported software wallet".
- In the next window that will open, select "Master Private Key BIP32" and paste that zprv key you get it from the cryptography tool
and click "import". It will show you that is a m/84/0/0 derivation path (as it should be).
- Click on "Import Keystore" and it will go back to main window of the wallet app where you can see all the wallet config.
Click on "apply" and will prompt you to set a password to encrypt your local wallet file.
- Sparrow app will start scanning all your keys and txs and it will be displayed after
a while in the "Transactions" tab. Patience, it will take some time.
And done! You've just restore your Blixt onchain wallet in Sparrow.
D. Using another LND node instance.
Yes, is fully compatible with any desktop LND node, as myNode, Raspiblitz, Umbrel, Nodl, Citadel etc.
You could even restore your funds from LN channels if you have the SCB file (static channels backup) from Blixt.
Simply follow the regular procedure of restoring a LND node using the seed + scb file:
LND nodes procedures
Payments with Blixt not working. What can I do?
During the Blixt v0.6.2 our team did a lot of testing in regards of pruned zombie channels
that were affecting the normal activity of LN users and especially Blixt users.
To fix this annoying issue (payments stuck or mostly failed) it was released the Blixt v0.6.3
with a special flag for prunning all these zombie channels.
Unfortunately, to get rid totally of this issue, Blixt users must close old existing channels,
create from scratch a new Blixt wallet / nodeID using the new v0.6.3 or next ones.
Procedure A - keep the same Blixt nodeID/ wallet seed:
- Open your Blixt Wallet, wait to be fully synced (onchain and LN graph).
- Go to top drawer and select "Lightning Channels".
- Select "close channel" for each channel you already have open.
- Keep your Blixt app online / active until you see the closing transaction done and your funds are back in your onchain wallet.

- Now, you can go and uninstall the existing Blixt app (v 0.6.2). It will wipe all Blixt data from your device.
- Install the newest Blixt version (v0.6.3 or 0.6.4...)
- When you start the new Blixt app, select "Restore" and put your previous 24 words seed.
- Wait until is recovered and all the old addresses are rescaned and your funds will appear in the Blixt onchain wallet. Have patience.
- Now you are ready to open new LN channels as usual with the balance you already have restored.
Procedure B - create a new Blixt nodeID / wallet seed:
- Open your Blixt Wallet, wait to be fully synced (onchain and LN graph).
- Go to top drawer and select "Lightning Channels".
- Select "close channel" for each channel you already have open.
- Keep your Blixt app online / active until you see the closing transaction done and your funds are back in your onchain wallet.
- Go to top drawer - "Onchain wallet" and send all funds to other external onchain wallet (temporary).
- Now, you can go and uninstall the existing Blixt app (v 0.6.2). It will wipe all Blixt data from your device.
- Install the newest Blixt version (v0.6.3 or 0.6.4...)
- When you start the new Blixt app, select "New wallet" and follow all the instructions for a new Blixt wallet.
- Wait until is synced and then send back all the sats you had in that temporary onchain wallet to this new Blixt wallet.
- Once you get back the sats, you are ready to open new LN channels as usual with the balance you already have restored.
If I reinstall Blixt Wallet or switch devices, can I keep my previous channels?
Right now, NO. In the future, maybe it will be possible through a more advanced procedure saving the wallet.db and channel.db files
from encrypted side of the device into a separate repository, from it can be made the migration to another device.
Blixt follows the LND standard procedure of restoring funds using the SCB file (SCB = static channels backup) previously saved
Until the optional procedure will be implemented, please make your usual SCB backups and follow the instructions described in the chapter Restore Blixt funds
REMINDER: do the SCB backup each time you open or close a LN channel. There's NO need after each payment.
Does Blixt Wallet have a Lightning Address I can receive with?
NO, NOT right now. But soon it will have added a new powerful feature named Lightning Box"
This feature will provide the user with a personalized self custodial Lightning Address linked to his own Blixt wallet.
Stay tuned, soon will be released this new feature for Blixt!


Wikipedia founder Jimmy Wales has a new ad-free, news-focused social network, WT:Social
by Mark Wyciślik-WilsonSocial media has evolved over the years in ways that few could have predicted. The likes of Facebook and Twitter are used not only for keeping in touch with friends and family, but also for keeping up to date with news.
But there are endless problems with current social networks, with ads and fake or misleading news being serious problems and irritants. Jimmy Wales, the founder of Wikipedia, has launched a new social network called WT:Social. It is free from ads and has a news focus. Importantly, users are able to edit headlines which are incorrect or deceptive.
See also:
- The Facebook app could be secretly using your iPhone camera behind your back
- Facebook Pay launches in the US, with payment options in Facebook, Messenger, WhatsApp and Instagram
- Twitter bans all political ads, and the world waits to see if Facebook will follow suit
The site has only just launched, but WT:Social -- an offshoot of WikiTribune -- already has tens of thousands of users. For anyone who uses Facebook and Twitter for news, the site will hold great appeal, but the promise of an ad-free experience is an added lure. So how can the site be sustained?
WT:Social says that it relies on "the generosity of individual donors", and promises never to sell user data. If you sign up for an account at the moment, you'll be added to a waiting list for access -- but it possible to gain instant access by paying a subscription ($12.99 per month, or $100.00 annually), or jump up the waiting list by inviting others to join.
The social network offers up something of a mission statement to anyone signing up:
We will empower you to make your own choices about what content you are served, and to directly edit misleading headlines, or flag problem posts. We will foster an environment where bad actors are removed because it is right, not because it suddenly affects our bottom-line.
Wales has been giving updates about sign-up numbers on Twitter:
Upon signing up, users are invited to join groups called subwikis. These already cover just about every topic imaginable, but it remains to be seen whether WT:Social's impressive rate of sign-ups continues, and also just how sustainable the site ends up being, reliant as it is on subscriptions and donations.
You can sign up for an account here.


Loading...
This presentation is an HTML5 website
Press → key to advance.
- ← and → to move around.
- Ctrl/Command and + or - to zoom in and out if slides don’t fit.
- S to view page source.
- T to change the theme.
- H to toggle syntax highlight.
- N to toggle speaker notes.
- 3 to toggle 3D effect.
- 0 to toggle help.
Title (w/ Heading 1)
Subtitle (w/ Heading 2)
Agenda - Table of Contents
Some text here (No header)
Heading 2
Some text here (No header)


Table-Of-Content (TOC) Files
Introduction
DocFX supports processing Markdown files or Conceptual Files, as well as structured data model in YAML or JSON format or Metadata Files. Besides that, DocFX introduces a way to organize these files using Table-Of-Content Files or TOC Files, so that users can navigate through Metadata Files and Conceptual Files.
Note
TOC Files must have file name toc.md
or toc.yml
, but the file name is case-insensitive.
Basic format
Markdown format TOC toc.md
toc.md
leverages Markdown Atx-style headers which use 1-6 hash characters at the start of the line to represent the TOC levels 1-6. We call each line starting with hash characters a TOC Item. A TOC Item with higher level is considered as the child of the nearest upper TOC Item with lower level.
A sample toc.md
is as below:
# [Header1](href)
## [Header1.1](href)
# Header2
## [Header2.1](href)
### [Header2.1.1](href)
## [Header2.2](href)
# @UidForAnArticle
Note
For a TOC Item, it can be either plain text, or a Markdown inline link, or @uid
as the shortcut for cross-reference.
Three kinds of links are supported:
- Absolute path, for example,
http://example.net
. - Relative path, for example,
../example.md
. This kind of link has several advanced usages and is described in detail below. - URI with
xref
scheme or@
syntax, for example,xref:System.String
<EMAIL_ADDRESS>. The value is theuid
of the file to cross-reference.
YAML format TOC toc.yml
Comparing to toc.md
, toc.yml
represents a structured data model and conforms to the YAML standard. It supports advanced functionalities.
Data model for toc.yml
The data model for toc.yml
is an array of TOC Item Objects.
A sample toc.yml
is as below:
- name: Topic1
href: Topic1.md
- name: Topic2
href: Topic2.md
items:
- name: Topic2_1
href: Topic2_1.md
TOC Item Object
TOC Item Object represents the data model for each TOC Item.
Note
All property names are case sensitive.
| Property Name | Required or Optional | Type | Description |
|---|---|---|---|
| name | required | string | Specifies the title of the TOC Item. |
| href | optional | string | Specifies the navigation path of the TOC Item. If href is not specified, the TOC Item serves as a container to parent its children TOC Items. If href is an absolute path, the TOC Item navigates to that specified path. If href is a relative path, see below for details. |
| items | optional | TOC Item Object | Specifies the children TOC Items of current TOC Item. |
Advanced usages: Following properties are useful when a TOC links to another TOC, or links to a uid. They are all optional.
| Property Name | Type | Description |
|---|---|---|
| topicHref | string | Specifies the topic href of the TOC Item. It is useful when href is linking to a folder or TOC file or tocHref is used. |
| topicUid | string | Specifies the uid of the referenced file. If the value is set, it overwrites the value of topicHref. |
| string | ||
| string | uid of the referenced file. If the value is set, it overwrites the value of href. |
|
| string | uid of the homepage. If the value is set, it overwrites the value of homepage. |
href in detail
If a TOC Item is linking to a relative path, there are three cases:
- Linking to another TOC File, for example,
href: examples/toc.md
. - Linking to a folder, which means, the value of the link ends with
/
explicitly, for example,href: examples/
- Linking to some local file.
Each case is described in detail below.
Link to another TOC File
If the TOC Item is linking to some other TOC File in relative path, it is considered as a placeholder of the referenced TOC File. DocFX will extract the array of TOC Item Object from that TOC File and insert into current TOC Item recursively.
This technique is especially useful when you want DocFX to combine several TOC Files to build into one single TOC.
If homepage
topicHref
is set for this TOC Item, it will be considered as the href
of the expanded TOC Item.
For example, one toc.yml
file is like below:
- name: How-to tutorials
href: howto/toc.yml
topicHref: howto/overview.md
It references to the toc.yml
file under folder howto
, with the following content:
- name: "How-to1"
href: howto1.md
- name: "How-to2"
href: howto2.md
DocFX processes these toc.yml
files and expands the upper toc.yml
file into:
- name: How-to tutorials
href: howto/overview.md
topicHref: howto/overview.md
items:
- name: "How-to1"
href: howto/howto1.md
topicHref: howto/howto1.md
- name: "How-to2"
href: howto/howto2.md
topicHref: howto/howto2.md
Note
The referenced toc.yml
file under howto
folder will not be transformed to the output folder even if it is included in docfx.json
.
Link to a folder
If the Toc Item is linking to a folder, ending with /
explicitly, the link value for the Toc Item is determined in the following steps:
If
homepage
topicHref
orhomepageUid
topicUid
is set, the link value is resolved to the relative path tohomepage
topicHref
If
homepage
topicHref
orhomepageUid
topicUid
is not set, DocFX searches for Toc File under the folder, and get the first relative link to local file as the link value for current Toc Item. For example, if the Toc Item ishref: article/
, and the content ofarticle/toc.yml
is as follows:- name: Topic1 href: topic1.md
The link value for the Toc Item will be resolved to
article/topic1.md
.If there is no Toc File under the folder, the link value keeps unchanged.
Link to local file
If the Toc Item is linking to a local file, we call this local file In-Toc File. Make sure the file is included in docfx.json
.
Note
Not-In-Toc Files
When a local file is not referenced by any Toc Item, we call this local file Not-In-Toc File. Its TOC File is the nearest TOC File in output folder from the same folder as the local file to the root output folder.


This page demonstrates the egObj.
Note: The following are examples of egObjects being constructed and the types fo constructions that are possible.


Company Section
Support Home
Logout
Company Unique Code:
---
Company Name:
Company Locality:
Company Address:
Company Pincode:
Company Website:
Company Logo:
Company Description:
Company Employee Count:
Company Type:
Company Status:
@* source *@
Company Source:
Internal
Save


Programmer and Blockchain Enthusiast in Portland
Education
Experience
Recentia Health
Brenntag
Digerati
built with
LocalReach
an android app to connect people to the charities in their neighborhoods
fisc
budgeting and financial management app
QNA
a question and answer message board shell
Copyright (c) 2017 Copyright Holder All Rights Reserved.


class: center, middle, inverse, title-slide .title[ # Session 3: Data Wrangling ] .subtitle[ ## R for Stata Users ] .author[ ### Luiza Andrade, Rob Marty, Rony Rodriguez-Ramirez, Luis Eduardo San Martin, Leonardo Viotti, Marc-Andrea Fiorina ] .date[ ### The World Bank – DIME |
WB Github
March 2023 ] --- # Table of contents 1. [Introduction](#intro) 2. [Exploring your data](#exploring) 3. [ID variables](#id) 4. [Wrangling your data](#wrangling) 4. [Create variables](#variables) 5. [Appending and marging](#bind) 6. [Saving a dataframe](#saving) 7. [Factor variables](#factor) 8. [Reshaping](#reshaping) --- class: inverse, center, middle name: intro # Introduction

 --- # Introduction ### Initial Setup .panelset[ .panel[.panel-name[If You Attended Session 2] 1. Go to the `dime-r-training-mar2023` folder that you created yesterday, and open the `dime-r-training-mar2023` R project that you created there. ] .panel[.panel-name[If You Did Not Attend Session 2] 1. Create a folder named `dime-r-training-mar2023` in your preferred location in your computer. 2. Go to the [OSF page of the course](https://osf.io/86g3b/) and download the file in: `R for Stata Users - 2023 March` > `Data` > `dime-r-training-mar2023.zip`. 3. Unzip `dime-r-training-mar2023.zip`. 4. Open the `dime-r-training-mar2023` R project. ] ] --- # Introduction ### Goals of this session - To organize data in a way that it will be easier to analyze it and communicate it. -- ### Things to keep in mind - We'll take you through the same steps we've taken when we were preparing the datasets used in this course. - In most cases, your datasets won't be `tidy`. > **Tidy data**: A dataset is said to be tidy if it satisfies the following conditions: 1. Every column is a variable. 2. Every row is an observation. 3. Every cell is a single value. Therefore, messy data is any other arrangement of the data. --- # Introduction In this session, you'll be introduced to some basic concepts of data cleaning in R. We will cover: 1. Exploring a dataset; 2. Creating new variables; 3. Filtering and subsetting datasets; 4. Merging datasets; 5. Dealing with factor variables; 6. Saving data. > There are many other tasks that we usually perform as part of data cleaning that are beyond the scope of this session. ### Before we start, let's make sure we are ready: 1. Start a fresh RStudio session. 2. Open the RStudio project you created yesterday. 3. Create a new R Script called `exercises-session3.R` --- # Introduction: Packages ### Another important aspect to consider is R packages. Consider the following: .pull-left[ #### R is a new phone  ] .pull-right[ #### R packages are apps in your phone  ] --- # RECAP: Packages ### To install a package you can run the following command: ```r # To install install.packages("dplyr") ``` * Unlike Stata, R packages need to be loaded in each R session that will use them. * That means that, for example, a function that comes from the `dplyr` package cannot be used if the package has not been installed and loaded first. ### To load a package you can run the following command: ```r # To load library(tidyverse) ``` --- # RECAP: loading packages ```r # If you haven't installed the packages uncomment the next line # install.packages("tidyverse") # install.packages("here") # install.packages("janitor") library(tidyverse) # To wrangle data library(here) # A package to work with relative file paths library(janitor) # Additional data cleaning tools ``` > *Notes*: Remember you should always load your packages before your start coding. --- # RECAP: File paths The `here` package allows you to interact with your working directory. It will look for the closest R Project and set its location as the working directory. That's why it is important to set your RStudio project correctly. The goal of this package is to: - Easily reference your files in project-oriented workflows.  --- # RECAP: Loading a dataset in R Before we start wrangling our data, let's read our dataset. In R, we can use the `read.csv` function from Base R, or `read_csv` from the `readr` package if we want to load a CSV file. For this exercise, we are going to use the World Happiness Report (2015-2018) .exercise[ **Exercise 1:** Loading data using the `here` package: Use either of the functions mentioned above and load the three WHR datasets from the `DataWork/DataSets/Raw/Un WHR` folder. Use the following notation for each dataset: `whrYY`, e.g. `WHR2015.csv` becomes the `whr15` dataset. ]
−
+
00
:
45
-- .solution[ **Solution:** ```r whr15 <- read_csv(here("DataWork", "DataSets", "Raw", "Un WHR", "WHR2015.csv")) whr16 <- read_csv(here("DataWork", "DataSets", "Raw", "Un WHR", "WHR2016.csv")) whr17 <- read_csv(here("DataWork", "DataSets", "Raw", "Un WHR", "WHR2017.csv")) ``` ] --- # The pipe %>% operator * "Piping" in R can be seen as "**chaining**." This means that we are invoking multiple method calls. * Every time you have invoked a method (a function) this return an object that then is going to be used in the next pipe. .pull-left[ ```r rony %>% wake_up(time = "5:30") %>% get_out_of_bed() %>% do_exercise() %>% shower() %>% get_dressed() %>% eat(meal = "breakfast", coffee = TRUE) %>% brush_teeth() %>% work(effort = "mininum") ``` ] .pull-right[ ```r work( brush_teeth( eat( get_dressed( shower( do_exercise( get_out_of_bed( wake_up(rony, time = "5:30") ), ) ) ), meal = "breakfast", coffee = TRUE ) ), effort = "minimum" ) ``` ] --- # The pipe %>% operator From R for Data Science by Wickham & Grolemund: .medium[ > Pipes are a powerful tool for clearly expressing a sequence of multiple operations. The point of the pipe is to help you write code in a way that is easier to read and understand. [...] It focusses on verbs, not nouns. You can read this series of function compositions like it’s a set of imperative actions. ] --- # Janitor package: The clean_names() function The `clean_names()` function helps us when our variables names are pretty bad. For example, if we have a variable that is called **`GDP_per_CApita_2015`**, the `clean_names()` function will help us fix those messy names. > **Tip**: Pipe the `clean_names()` function after you load a dataset. ```r whr15 <- whr15 %>% * clean_names() whr16 <- whr16 %>% clean_names() whr17 <- whr17 %>% clean_names() ``` However, if we wan to to rename our variable manually, we could use: ```r whr15 <- whr15 %>% * rename( * var_newname = var_oldname * ) ``` --- class: inverse, center, middle name: exploring # Exploring your data

 --- # Exploring a data set These are some useful functions from base R: * `View()`: open the data set. * `class()`: reports object type of type of data stored. * `dim()`: reports the size of each one of an object's dimension. * `names()`: returns the variable names of a dataset. * `str()`: general information on an R object. * `summary()`: summary information about the variables in a data frame. * `head()`: shows the first few observations in the dataset. * `tail()`: shows the last few observations in the dataset. Some other useful functions from the tidyverse: * `glimpse()`: get a glimpse of your data. --- # Load and show a dataset We can just show our dataset using the name of the object; in this case, `whr15`. ```r whr15 ``` ``` ## # A tibble: 158 × 12 ## country region happi…¹ happi…² stand…³ econo…⁴ family healt…⁵ freedom trust…⁶ ## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 Switze… Weste… 1 7.59 0.0341 1.40 1.35 0.941 0.666 0.420 ## 2 Iceland Weste… 2 7.56 0.0488 1.30 1.40 0.948 0.629 0.141 ## 3 Denmark Weste… 3 7.53 0.0333 1.33 1.36 0.875 0.649 0.484 ## 4 Norway Weste… 4 7.52 0.0388 1.46 1.33 0.885 0.670 0.365 ## 5 Canada North… 5 7.43 0.0355 1.33 1.32 0.906 0.633 0.330 ## 6 Finland Weste… 6 7.41 0.0314 1.29 1.32 0.889 0.642 0.414 ## 7 Nether… Weste… 7 7.38 0.0280 1.33 1.28 0.893 0.616 0.318 ## 8 Sweden Weste… 8 7.36 0.0316 1.33 1.29 0.911 0.660 0.438 ## 9 New Ze… Austr… 9 7.29 0.0337 1.25 1.32 0.908 0.639 0.429 ## 10 Austra… Austr… 10 7.28 0.0408 1.33 1.31 0.932 0.651 0.356 ## # … with 148 more rows, 2 more variables: generosity <dbl>, ## # dystopia_residual <dbl>, and abbreviated variable names ¹happiness_rank, ## # ²happiness_score, ³standard_error, ⁴economy_gdp_per_capita, ## # ⁵health_life_expectancy, ⁶trust_government_corruption ``` --- # Glimpse your data Use `glimpse()` to get information about your variables (e.g., type, row, columns,) ```r whr15 %>% * glimpse() ``` ``` ## Rows: 158 ## Columns: 12 ## $ country <chr> "Switzerland", "Iceland", "Denmark", "Norw… ## $ region <chr> "Western Europe", "Western Europe", "Weste… ## $ happiness_rank <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,… ## $ happiness_score <dbl> 7.587, 7.561, 7.527, 7.522, 7.427, 7.406, … ## $ standard_error <dbl> 0.03411, 0.04884, 0.03328, 0.03880, 0.0355… ## $ economy_gdp_per_capita <dbl> 1.39651, 1.30232, 1.32548, 1.45900, 1.3262… ## $ family <dbl> 1.34951, 1.40223, 1.36058, 1.33095, 1.3226… ## $ health_life_expectancy <dbl> 0.94143, 0.94784, 0.87464, 0.88521, 0.9056… ## $ freedom <dbl> 0.66557, 0.62877, 0.64938, 0.66973, 0.6329… ## $ trust_government_corruption <dbl> 0.41978, 0.14145, 0.48357, 0.36503, 0.3295… ## $ generosity <dbl> 0.29678, 0.43630, 0.34139, 0.34699, 0.4581… ## $ dystopia_residual <dbl> 2.51738, 2.70201, 2.49204, 2.46531, 2.4517… ``` --- class: inverse, center, middle name: id # Dimensions of your data

 --- # Dimensions of your data Let's see first how many columns and observations the dataset has: * **Dimensions of your data** (Rows and Columns): ```r dim(whr15) ``` ``` ## [1] 158 12 ``` * **The number of distinct values of a particular variable**: ```r n_distinct(DATASET$variable, na.rm = TRUE) ``` -- The `$` sign is a subsetting operator. In R, we have three subsetting operators (`[[`, `[`, and `$`.). It is often used to access variables in a dataframe. The `n_distinct` function allows us to count the number of unique values of a variable length of a vector. We included `na.rm = TRUE`, so we don't count missing values. --- # Dimensions of your data .exercise[ **Exercise 2**: Identify distinct values of a variable in a dataset. Using the `n_distinct` function, can you tell how many unique values these variables in the `whr15` dataset have? 1. Country 2. Region ]
−
+
01
:
00
-- .solution[ **Solution**: ```r n_distinct(whr15$country, na.rm = TRUE) ``` ``` ## [1] 158 ``` ```r n_distinct(whr15$region, na.rm = TRUE) ``` ``` ## [1] 10 ``` ] --- # Dimensions of your data We can also test whether the number of rows is equal to the number of distinct values in a specific variable as follows: ```r nrow(whr15) ``` ``` ## [1] 158 ``` -- We can use the two functions (`nrow` and `n_distinct`) together to test if their result is the same. ```r n_distinct(whr15$country, na.rm = TRUE) == nrow(whr15) ``` ``` ## [1] TRUE ``` ```r n_distinct(whr16$country, na.rm = TRUE) == nrow(whr16) ``` ``` ## [1] TRUE ``` ```r n_distinct(whr17$country, na.rm = TRUE) == nrow(whr17) ``` ``` ## [1] TRUE ``` --- class: inverse, center, middle name: wrangling # Wrangling your data

 --- # Wrangling vs Cleaning .large[ **Cleaning:** - Detecting and addressing inconsistencies in a dataset. Removing erroneous data from your data. **Wrangling:** - Translating raw data into a more useful form. Unifying messy and complex data. ] --- # dplyr::filter - The `filter` function is used to subset rows in a dataset. ```r whr15 %>% filter(region == "Western Europe") ``` ``` ## # A tibble: 21 × 12 ## country region happi…¹ happi…² stand…³ econo…⁴ family healt…⁵ freedom trust…⁶ ## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 Switze… Weste… 1 7.59 0.0341 1.40 1.35 0.941 0.666 0.420 ## 2 Iceland Weste… 2 7.56 0.0488 1.30 1.40 0.948 0.629 0.141 ## 3 Denmark Weste… 3 7.53 0.0333 1.33 1.36 0.875 0.649 0.484 ## 4 Norway Weste… 4 7.52 0.0388 1.46 1.33 0.885 0.670 0.365 ## 5 Finland Weste… 6 7.41 0.0314 1.29 1.32 0.889 0.642 0.414 ## 6 Nether… Weste… 7 7.38 0.0280 1.33 1.28 0.893 0.616 0.318 ## 7 Sweden Weste… 8 7.36 0.0316 1.33 1.29 0.911 0.660 0.438 ## 8 Austria Weste… 13 7.2 0.0375 1.34 1.30 0.890 0.624 0.187 ## 9 Luxemb… Weste… 17 6.95 0.0350 1.56 1.22 0.919 0.616 0.378 ## 10 Ireland Weste… 18 6.94 0.0368 1.34 1.37 0.895 0.618 0.287 ## # … with 11 more rows, 2 more variables: generosity <dbl>, ## # dystopia_residual <dbl>, and abbreviated variable names ¹happiness_rank, ## # ²happiness_score, ³standard_error, ⁴economy_gdp_per_capita, ## # ⁵health_life_expectancy, ⁶trust_government_corruption ``` --- # dplyr::filter .exercise[ **Exercise 3:** Use `filter()` to extract rows in these regions: (1) Eastern Asia and (2) North America. Hint: use the **or** operator (`|`): ]
−
+
01
:
00
-- .solution[ **Solution:** ```r whr15 %>% filter(region == "Eastern Asia" | region == "North America") ``` A more elegant approach would be to use the `%in%` operator (equivalent to `inlist()` in Stata): ```r whr15 %>% filter(region %in% c("Eastern Asia", "North America")) ``` ] --- # dplyr::filter missing cases If you want to remove (or identify) missing cases for a specific variable, you can use `is.na()`. * This function returns a value of true and false for each value in a data set. * If the value is *NA* the `is.na()` function returns TRUE, otherwise, it returns FALSE. * In this way, we can check NA values that can be used for other functions. * We can also negate the function using `!is.na()` which indicates that we want to return those observations with no missing values in a variable. The function syntax in a pipeline is as follows: ```r DATA %>% filter( * is.na(VAR) ) ``` **What are we returning here?** -- The observations with missing values for the variable VAR. --- # dplyr::filter missing cases Let's try filtering the `whr15` data. Let's keep those observations that have information per region, i.e., no missing values. ```r whr15 %>% * filter(!is.na(region)) %>% head(5) ``` ``` ## # A tibble: 5 × 12 ## country region happi…¹ happi…² stand…³ econo…⁴ family healt…⁵ freedom trust…⁶ ## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 Switzer… Weste… 1 7.59 0.0341 1.40 1.35 0.941 0.666 0.420 ## 2 Iceland Weste… 2 7.56 0.0488 1.30 1.40 0.948 0.629 0.141 ## 3 Denmark Weste… 3 7.53 0.0333 1.33 1.36 0.875 0.649 0.484 ## 4 Norway Weste… 4 7.52 0.0388 1.46 1.33 0.885 0.670 0.365 ## 5 Canada North… 5 7.43 0.0355 1.33 1.32 0.906 0.633 0.330 ## # … with 2 more variables: generosity <dbl>, dystopia_residual <dbl>, and ## # abbreviated variable names ¹happiness_rank, ²happiness_score, ## # ³standard_error, ⁴economy_gdp_per_capita, ⁵health_life_expectancy, ## # ⁶trust_government_corruption ``` > Notice that we are negating the function, i.e., `!is.na()`
 In case we want to keep the observations that contains missing information we will only use `is.na()`. --- class: inverse, center, middle name: variables # Creating new variables

 --- # Creating new variables We use `mutate()` to create new variables. For example: ```r whr15 %>% * mutate( * hap_hle = happiness_score * health_life_expectancy * ) ``` This will add a new variable called `hap_hle` which is the interaction of happiness score and health life expectancy. --- # Creating new variables: Dummy variables ```r whr15 %>% mutate(happiness_score_6 = (happiness_score > 6)) ``` **What do you think is happening to this variable?** -- This new variables contains either `TRUE` or `FALSE`. To have it as a numeric variable (1 or 0, respectively), we include the `as.numeric()` function. -- ```r whr15 %>% mutate(happiness_score_6 = as.numeric((happiness_score > 6))) ``` -- Finally, instead of using a random number, such as 6, we can do the following: ```r whr15 %>% mutate( happiness_high_mean = as.numeric((happiness_score > mean(happiness_score, na.rm = TRUE))) ) ``` --- # Creating variables by groups In R, we can use `group_by()` before we mutate to group an estimation. For example, we are going to pipe the following functions: 1. Group our data by the `region` variable. 2. Create a variable that would be the mean of `happiness_score` by each region. 3. Select the variables `country, region, happiness_score, mean_hap`. .panelset[ .panel[.panel-name[Example] ```r DATASET %>% * group_by(GROUPING VARIABLE) %>% mutate( NAME OF NEW VAR = mean(VARIABLE, na.rm = TRUE) ) %>% select(VAR1, VAR2, VAR3, VAR4) ``` ] .panel[.panel-name[With variables] ```r whr15 %>% group_by(region) %>% mutate( mean_hap = mean(happiness_score, na.rm = TRUE) ) %>% select(country, region, happiness_score, mean_hap) ``` ] .panel[.panel-name[Output] ``` ## # A tibble: 7 × 4 ## # Groups: region [2] ## country region happiness_score mean_hap ## <chr> <chr> <dbl> <dbl> ## 1 Switzerland Western Europe 7.59 6.69 ## 2 Iceland Western Europe 7.56 6.69 ## 3 Denmark Western Europe 7.53 6.69 ## 4 Norway Western Europe 7.52 6.69 ## 5 Canada North America 7.43 7.27 ## 6 Finland Western Europe 7.41 6.69 ## 7 Netherlands Western Europe 7.38 6.69 ``` ] ] --- # Creating multiple variables at the same time We can create multiple variables in an easy way. Let's imagine that we want to estimate the mean value for the variables: `happiness_score`, `health_life_expectancy`, and `trust_government_corruption` . #### How we can do it? * We can use the function `across()`.
 Syntax: `across(VARS that you want to transform, FUNCTION to execute)`. * `across()` should be always use inside `summarise()` or `mutate()`. .panelset[ .panel[.panel-name[Across] ```r vars <- c("happiness_score", "health_life_expectancy", "trust_government_corruption") whr15 %>% group_by(region) %>% summarize( * across( * all_of(vars), mean * ) ) %>% head(3) ``` ] .panel[.panel-name[Output] ``` ## # A tibble: 3 × 4 ## region happiness_score health_life_expectancy trust_gove…¹ ## <chr> <dbl> <dbl> <dbl> ## 1 Australia and New Zealand 7.28 0.920 0.393 ## 2 Central and Eastern Europe 5.33 0.719 0.0867 ## 3 Eastern Asia 5.63 0.877 0.128 ## # … with abbreviated variable name ¹trust_government_corruption ``` ] ] --- # Creating variables .exercise[ **Exercise 4:** Create a variable called `year` that equals to the year of each dataframe using the `mutate()`. Remember to assign it to the same dataframe.
−
+
01
:
00
] -- .solution[ **Solution:** ```r whr15 <- whr15 %>% mutate(year = 2015) whr16 <- whr16 %>% mutate(year = 2016) whr17 <- whr17 %>% mutate(year = 2017) ``` ] --- class: inverse, center, middle name: bind # Appending and merging data sets

 --- # Appending dataframes Now that we can identify the observations, we can combine the data set. Here are two functions to append objects by row ```r rbind(df1, df2, df3) # The base R function bind_rows(df1, df2, df3) # The tidyverse function, making some improvements to base R ``` .exercise[ **Exercise 5:** Append data sets. Use the function `bind_rows` to append the three WHR datasets:
−
+
00
:
45
] -- .solution[ **Solution:** ```r bind_rows(whr15, whr16, whr17) ``` ] -- .notes[ **Notes** * One of the problems with binding rows like this is that, sometimes, some columns are not *fully* compatible. ] --- # Appending and merging data sets .exercise[ .medium[ **Exercise 6:** Fixing our variables and appending the data frames correctly. ] *Exercise 6a* * Load the R data set `regions.RDS` from `DataWork/DataSets/Raw/Un WHR` using the `read_rds` function.
−
+
00
:
45
] -- .solution[ **Solution:** ```r regions <- read_rds(here("DataWork", "DataSets", "Raw", "Un WHR", "regions.RDS")) ``` ] --- # Appending and merging data sets We can use the `left_join()` function to merge two dataframes. The function syntax is: `left_join(a_df, another_df, by = c("id_col1"))`. > A left join takes all the values from the first table, and looks for matches in the second table. If it finds a match, it adds the data from the second table; if not, it adds missing values. It is the equivalent of `merge, keep(master matched)` in Stata. -- .exercise[ **Exercise 6b:** Join the dataframes: `regions` and `whr17`. ]
−
+
01
:
00
-- .pull-left[ .solution[ **Solution:** ```r *whr17 <- whr17 %>% * left_join(regions, by = "country") %>% select(country, region, everything()) ``` ] ] .pull-right[ .notes[ **Notes:** Look at the `everything()` function. It takes all the variables from the dataframe and put them after country and region. In this way, select can be use to **order** columns! ] ] --- # Appending and merging data sets .exercise[ **Exercise 6c:** Check if there is any other countries in `whr17` without region info: * Only use pipes %>% * And `filter()` * Do not assign it to an object. ]
−
+
01
:
00
-- .solution[ **Solution:** ```r whr17 %>% filter(is.na(region)) ``` ``` ## # A tibble: 2 × 14 ## country region happi…¹ happi…² whisk…³ whisk…⁴ econo…⁵ family healt…⁶ freedom ## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 Taiwan … <NA> 33 6.42 6.49 6.35 1.43 1.38 0.794 0.361 ## 2 Hong Ko… <NA> 71 5.47 5.55 5.39 1.55 1.26 0.943 0.491 ## # … with 4 more variables: generosity <dbl>, trust_government_corruption <dbl>, ## # dystopia_residual <dbl>, year <dbl>, and abbreviated variable names ## # ¹happiness_rank, ²happiness_score, ³whisker_high, ⁴whisker_low, ## # ⁵economy_gdp_per_capita, ⁶health_life_expectancy ``` ] --- # So we ended up with two countries with NAs This is due to the name of the countries. The regions dataset doesn't have "Taiwan Province of China" nor "Hong Kong S.A.R., China" but "Taiwan" and "Hong Kong." #### How do you think we should solve this? -- * My approach would be to: 1. fix the names of these countries in the `whr17` dataset (a data cleaning task) and; 2. merge (left_join) it with the regions dataset. Appendix: [case_when and mutate](#case_when) for more information. --- # Appending and merging data sets Finally, let's keep those relevant variables first and bind those rows. .exercise[ **Exercise 7:** Bind all rows and create a panel called: `whr_panel`. * Select the variables: `country`, `region`, `year`, `happiness_rank`, `happiness_score`, `economy_gdp_per_capita`, `health_life_expectancy`, `freedom` for each df, i.e., `whr15`, `whr16`, `whr17`. * Use `rbind()`
−
+
01
:
00
] -- .solution[ **Solution:** ```r vars_to_keep <- c("country", "region", "year", "happiness_rank", "happiness_score", "economy_gdp_per_capita", "health_life_expectancy", "freedom") whr15 <- select(whr15, all_of(vars_to_keep)) whr16 <- select(whr16, all_of(vars_to_keep)) whr17 <- select(whr17, all_of(vars_to_keep)) whr_panel <- rbind(whr15, whr16, whr17) # or bind_rows ``` ] --- class: inverse, center, middle name: saving # Saving a dataset

 --- # Saving a dataset * The dataset you have is the same data set we’ve been using for earlier sessions, so we can save it now. * To save a dataset we can use the `write_csv` function from the `readr` package, or `write.csv` from base R. The function takes the following syntax: `write_csv(x, file, append = FALSE, row.names = FALSE, na = "")`: * `x:` the object (usually a data frame) you want to export to CSV * `file:` the file path to where you want to save it, including the file name and the format (“.csv”) --- # Saving a dataset .exercise[ **Exercise 8:** Save the dataset as csv format in the "Final" folder with the name `whr_panel_**YOUR INITIALS**.csv` * Use `write_csv()` * Use `here()`
−
+
01
:
00
] -- .solution[ **Solution:** ```r write_csv( whr_panel, here("DataWork", "DataSets", "Final", "whr_panel_MA.csv") ) ``` ] .notes[ * The problem with CSVs is that they cannot differentiate between `strings` and `factors` * They also don’t save factor orders * Data attributes (which are beyond the scope of this training, but also useful to document data sets) are also lost. ] --- # Saving a dataset The R equivalent of a `.dta` file is a `.rds` file. It can be saved and loaded using the following commands: * `write_rds(object, file = "")`: Writes a single R object to a file. * `read_rds(file)`: Load a single R object from a file. ```r # Save the data set write_rds( whr_panel, here("DataWork", "DataSets", "Final", "whr_panel_MA.Rds") ) ``` --- class: inverse, center, middle # And that's it for this session. Join us next week~ --- class: inverse, center, middle name: appendix # Appendix

 --- # Missing values in R #### Quick Note: .pull-left[ * Missings in R are treated differently than in Stata. They are represented by the NA symbol. * Impossible values are represented by the symbol NaN which means 'not a number.' * R uses the same symbol for character and numeric data. ] .pull-right[ * NA is not a string or a numeric value, but an indicator of missingness. * NAs are contagious. This means that if you compare a number with NAs you will get NAs. * Therefore, always remember the `na.rm = TRUE` argument if needed. ] --- # Other relevant functions: slice, subset, select .panelset[ .panel[.panel-name[Arrange] `Arrange`: allows you to order by a specific column. ```r whr15 %>% arrange(region, country) %>% head(5) ``` ``` ## # A tibble: 5 × 8 ## country region year happi…¹ happi…² econo…³ healt…⁴ freedom ## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 Australia Australia and New Z… 2015 10 7.28 1.33 0.932 0.651 ## 2 New Zealand Australia and New Z… 2015 9 7.29 1.25 0.908 0.639 ## 3 Albania Central and Eastern… 2015 95 4.96 0.879 0.813 0.357 ## 4 Armenia Central and Eastern… 2015 127 4.35 0.768 0.730 0.198 ## 5 Azerbaijan Central and Eastern… 2015 80 5.21 1.02 0.640 0.370 ## # … with abbreviated variable names ¹happiness_rank, ²happiness_score, ## # ³economy_gdp_per_capita, ⁴health_life_expectancy ``` ] .panel[.panel-name[Slice] `Slice`: allows you to select, remove, and duplicate rows. ```r whr15 %>% slice(1:5) # to select the first 5 rows ``` ``` ## # A tibble: 5 × 8 ## country region year happiness_r…¹ happi…² econo…³ healt…⁴ freedom ## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 Switzerland Western Europe 2015 1 7.59 1.40 0.941 0.666 ## 2 Iceland Western Europe 2015 2 7.56 1.30 0.948 0.629 ## 3 Denmark Western Europe 2015 3 7.53 1.33 0.875 0.649 ## 4 Norway Western Europe 2015 4 7.52 1.46 0.885 0.670 ## 5 Canada North America 2015 5 7.43 1.33 0.906 0.633 ## # … with abbreviated variable names ¹happiness_rank, ²happiness_score, ## # ³economy_gdp_per_capita, ⁴health_life_expectancy ``` You can also use `slice_head` and `slice_tail` to select the first or last rows respectively. Or `slice_sample` to randomly draw n rows. ] .panel[.panel-name[Select] `Select`: allows you to select specific columns. ```r whr15 %>% select(region, country, happiness_rank) ``` ``` ## # A tibble: 158 × 3 ## region country happiness_rank ## <chr> <chr> <dbl> ## 1 Western Europe Switzerland 1 ## 2 Western Europe Iceland 2 ## 3 Western Europe Denmark 3 ## 4 Western Europe Norway 4 ## 5 North America Canada 5 ## 6 Western Europe Finland 6 ## 7 Western Europe Netherlands 7 ## 8 Western Europe Sweden 8 ## 9 Australia and New Zealand New Zealand 9 ## 10 Australia and New Zealand Australia 10 ## # … with 148 more rows ``` ] .panel[.panel-name[Combining functions] `Select`: allows you to specific columns. ```r whr15 %>% arrange(region, country) %>% # Sort by region and country filter(!is.na(region)) %>% # Filter those non-missing obs for region if any select(country, region, starts_with("happin")) %>% # Select country, year, and vars that stars with happin slice_head() # Get the first row ``` ``` ## # A tibble: 1 × 4 ## country region happiness_rank happiness_score ## <chr> <chr> <dbl> <dbl> ## 1 Australia Australia and New Zealand 10 7.28 ``` ] ] --- # Using ifelse when creating a variable We can also create a dummy variable with the `ifelse()` function. The way we use this function is as: `ifelse(test, yes, no)`. We can also use another function called `case_when()`. ```r whr15 %>% mutate( latin_america_car = ifelse(region == "Latin America and Caribbean", 1, 0) ) %>% arrange(-latin_america_car) %>% head(5) ``` ``` ## # A tibble: 5 × 9 ## country region year happi…¹ happi…² econo…³ healt…⁴ freedom latin…⁵ ## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 Costa Rica Latin Americ… 2015 12 7.23 0.956 0.860 0.634 1 ## 2 Mexico Latin Americ… 2015 14 7.19 1.02 0.814 0.482 1 ## 3 Brazil Latin Americ… 2015 16 6.98 0.981 0.697 0.490 1 ## 4 Venezuela Latin Americ… 2015 23 6.81 1.04 0.721 0.429 1 ## 5 Panama Latin Americ… 2015 25 6.79 1.06 0.797 0.542 1 ## # … with abbreviated variable names ¹happiness_rank, ²happiness_score, ## # ³economy_gdp_per_capita, ⁴health_life_expectancy, ⁵latin_america_car ``` --- name: case_when # Using case_when() to update a variable Recall the problem we have with regions in the `whr17` data. We can fix it as follows: ```r whr17 <- whr17 %>% mutate( country = case_when( country == "Hong Kong S.A.R., China" ~ "Hong Kong", country == "Taiwan Province of China" ~ "Taiwan", TRUE ~ country ) ) whr17 %>% left_join(regions, by = "country") %>% rename(region = region.y) %>% select(-region.x) %>% select(country, region, everything()) %>% filter(is.na(region)) ``` --- class: inverse, center, middle name: factor # Factor variables

 --- # Factor variables * When we imported this data set, we told R explicitly to not read strings as factor. * We did that because we knew that we’d have to fix the country names. * The region variable, however, should be a factor. ```r str(whr_panel$region) ``` ``` ## chr [1:470] "Western Europe" "Western Europe" "Western Europe" ... ``` --- # Factor variables To create a factor variable, we use the `factor()` function (or `as_factor()` from the `forcats` package). * `factor(x, levels, labels)` : turns numeric or string vector `x` into a factor vector. * `levels`: a vector containing the possible values of `x`. * `labels`: a vector of strings containing the labels you want to apply to your factor variable * `ordered`: logical flag to determine if the levels should be regarded as ordered (in the order given). -- If your categorical variable does not need to be ordered, and your string variable already has the label you want, making the conversion is quite easy. --- # Factor variables .exercise[ **Extra exercise:** Turn a string variable into a factor. * Use the mutate function to create a variable called region_cat containing a categorical version of the region variable. * TIP: to do this, you only need the first argument of the factor function. ] -- .solution[ **Solution:** ```r whr_panel <- mutate(whr_panel, region_cat = factor(region)) ``` ] -- And now we can check the class of our variable. ```r class(whr_panel$region_cat) ``` ``` ## [1] "factor" ``` --- class: inverse, center, middle name: reshaping # Reshaping a dataset

 --- # Reshaping a dataset Finally, let's try to reshape our dataset using the tidyverse functions. No more `reshape` from Stata. We can use `pivot_wider` or `pivot_longer`. Let's assign our wide format panel to an object called whr_panel_wide. .panelset[ .panel[.panel-name[Long to Wide] ```r whr_panel %>% select(country, region, year, happiness_score) %>% pivot_wider( names_from = year, values_from = happiness_score ) %>% head(3) ``` ``` ## # A tibble: 3 × 5 ## country region `2015` `2016` `2017` ## <chr> <chr> <dbl> <dbl> <dbl> ## 1 Switzerland Western Europe 7.59 7.51 7.49 ## 2 Iceland Western Europe 7.56 7.50 7.50 ## 3 Denmark Western Europe 7.53 7.53 7.52 ``` ] .panel[.panel-name[Wide to Long] ```r whr_panel_wide %>% pivot_longer( cols = `2015`:`2017`, names_to = "year", values_to = "happiness_score" ) %>% head(3) ``` ``` ## # A tibble: 3 × 4 ## country region year happiness_score ## <chr> <chr> <chr> <dbl> ## 1 Switzerland Western Europe 2015 7.59 ## 2 Switzerland Western Europe 2016 7.51 ## 3 Switzerland Western Europe 2017 7.49 ``` ] ] --- class: inverse, center, middle # Thank you~ --- exclude: true


Section 1
May be come from the publish-subsribe domain
Section 2
describes the IFP domain in more detail, provides an initial description of the different technologies that have been developed to support it, and explains the need for combining the best of different worlds to fully support IFP applications.
Active database system
- Something origial DB can not do
- There are several tools classified as active database systems, with different software architectures, functionality, and oriented toward different application domains
Section 3
describes a framework to model and analyze the different aspects that are relevant for an IFP engine from its functional architecture, to its data and processing models, to the language it provides to express how information has to be processed, to its run-time architecture.
- Functional Model
- Each time a new item (including those periodically produced by the Clock) enters the engine through the Receiver
- Evaluates all the rules currently present in the Rules store to find those whose condition part is true.
- At the end of this phase we have a set of rules that have to be executed.
- Processing Model
- Together with the last information item entering the Decider, the set of deployed rules, and the information stored in the History and in the Knowledge Base, three additional concepts concur at uniquely determining the output of a single detection- production cycle: the selection, consumption, and load shedding policies adopted by the system.
- some systems offer a programmable policy, by including special language constructs that enable users to decide, often rule by rule, if they have to fire once or more than once at each detection-production cycle, and in the former case, which elements have to be actually selected among the different possible combinations.
- Load shedding. Load shedding is a technique adopted by some IFP systems to deal with bursty inputs. It can be described as an automatic drop of information items when the input rate becomes too high for the processing capabilities of the engine.
-
Deployment Model
- A networked IFP engine focuses on minimizing network usage by dispersing processors over a wide area network, with the goal of
processing information as close as possible to the sources
.
- In summary, in their seek for better scalability, clustered and networked engines focus on different aspects: the former on increasing the available processing power by sharing the workload among a set of well connected machines, the latter on minimizing bandwidth usage by processing information as close as possible to the sources.
- Interaction Model
- In a pull observation model, the IFP engine is the initiator of the interaction to bring information from sources to the engine; otherwise we have a push observation model.
- Data Model
- Former manipulate generic data items
- While the latter manipulates event notifications
- In many IFP scenarios, in fact, information received from sources has an associated degree of uncertainty. As an example, if sources were only able to provide rounded data [Wasserkrug et al. 2008], the system could associate such data with a level of uncertainty instead of accepting it as a precise information.
- Engines allow different types of information items in the same flow.
-
Time Model
- With the term time model we refer to the relationship between the information items flowing into the IFP engine and the passing of time. More precisely, we refer to the ability of the IFP system of associating some kind of happened-before relationship to information items.
- There is the case of systems that associate items with an interval, i.e., two timestamps taken from a global time, usually representing: the time when the related event started, the time when it ended. In this case, depending on the semantics associated with intervals, a total or a partial ordering among items can be defined.
-
Rule Model
- Rules are much more complex entities than data. Looking at existing systems we can find many different approaches to represent rules, which depend on the adopted rule language. However, we can roughly classify them in two macro classes: transforming rules and detecting rules.
- Language Model
- It is worth mentioning that existing systems sometime allow users to express rules using more than one paradigm. For example, many commercial systems offer both a declarative language for rule creation, and a graphical tool for connecting defined rules in an imperative way. Moreover, some existing declarative languages embed simple operators for pattern detection, blurring the distinction between transform- ing and detecting languages.
- SQL
- Available Operators
- Logistic Operators
-
Section 4
We use this framework in Section 4 to describe and compare the state of the art in the field.
- In the following we use the concepts introduced in Section 3 to present and classify existing IFP systems. We provide a brief description of each system and summarize its characteristics by compiling four tables.
-
Table I focuses on the functional and processing models of each system: it shows if a system includes the Clock (i.e., it supports periodic processing) and the Knowl- edge Base, and if the maximum size of the sequences (Seq) that the Decider sends to the Producer is bounded or unbounded, given the set of deployed rules. Then, it analyzes if information items produced by fired rules may re-enter the system (recursion), and if the rule set can be changed by fired actions at run-time. Fi- nally, it presents the processing model of each system, by showing its selection, consumption, and load shedding policies.
-
Table II focuses on the deployment and interaction models, by showing the type of deployment supported by each system, and the interaction styles allowed in the observation, notification, and forwarding models.
-
Table III focuses on the data, time, and rule models, presenting the nature of the items processed by each systems (generic data or event notifications), the format of data, the support for data uncertainty, and the nature of flows (homogeneous or heterogeneous). It also introduces how the notion of time is captured and rep- resented by each system, the type of rules adopted, and the possibility to define probabilistic rules.
-
Finally, Table IV focuses on the language adopted by each system, by listing its type and the set of operators available.
- Active databases
- Data Stream Management Systems
- Usually, these systems are designed for application domains in which the timeliness requirement is less critical, like for example Internet updates monitoring. On the contrary, all remaining systems are heavily tailored for the processing of high rate streams.
- Commercial Systems
- The platform is designed to scale by exploiting multiple cores on a single ma- chine or multiple machines in a clustered environment.
- Aleri Streaming Platform.
- Coral8 CEP Engine.
- StreamBase.
- Oracle CEP.
- Esper.
- Tibco Business Events.
- IBM System S.
- Other commercial systems.
- IBM WebSphere Business Events.
- Event Zero.
- Progress Apama Event Processing Platform.
Section 5
Discussing the results of such classification in Section 5.
Section 6
Finally, Section 6 reviews related work, while Section 7 provides some conclusive remarks and a list of open issues.
- In this section we briefly discuss the results of on-going or past research which aims at providing a more complete understanding of the IFP domain. In particular we cover four different aspects:
- we present work that studies general mechanisms for IFP;
- we review specific models used to describe various classes of systems, or to address single issues;
- we provide an overview of systems presenting similarities with IFP systems;
- we discuss existing attempts to create a standard for the IFP domain.
- Many researchers focused on developing general mechanisms for IFP by studying (i) rule processing strategies, (ii) operator placement and load balancing algorithms, (iii) communication protocols for distributed rule processing, (iv) techniques to provide adequate levels of QoS, and (v) mechanisms for high availability and fault tolerance.
- In distributed scenarios it is of primary importance to define efficient communica- tion strategies between the different actors (sources, processors, and sinks).
- Different contributions, primarily from people working on stream processing, fo- cused on the problem of bursty arrival of data
- Recently, a few works coming from the event-based community
- Finally, a few works have focused on high-availability and fault tolerance for dis- tributed stream processing.
Other Models
-
As we have seen, IFP is a large domain, including many systems. Although the literature misses a unifying model, which is able to capture and classify all existing works, various contributions are worth mentioning.
- System Models.
- As described in Section 2, two main models for IFP have emerged, one coming from the database community and one coming from the event- processing community.
- Models for Single Aspects of IFP.
- A relevant part of our classification focuses on the data representations and rule definition languages adopted by IFP systems, and on the underlying time model assumed for processing.
- Related Systems
- Besides the systems described in Section 4, other tools exist, which share many similarities with IFP systems.
- Runtime Verification Tools.
- Runtime Monitoring Tools.
- Scalable Distributed Information Management Systems.
Online Machine Learning


Class Client
Direct known subclasses
Simpletools\Db\Mysql\Model
public
|
|
public
|
|
public
|
|
public
|
|
public static
&
|
|
public static
&
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
&
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
string |
_noArgs
|
#
'$--SimpleMySQL--n0-aRg5--'
|
protected
boolean
|
$_credentials
|
#
false
|
protected
boolean
|
$_connected
|
#
false
|
protected
string
|
$_modelDir
|
#
''
|
protected
string
|
$_quotes_on
|
#
''
|


This documentation is split into two sections, one for the discordClient library and another for the motorbot music API.
This is the documentation for the MotorbotMusicAPI, an API used to communicate with motorbot to allow playback of media in a voice channel. You can switch in the top left drop down menu or select below if you'de like to change to the DiscordClient Library.
Important
This documentation is still under development and some information may not be complete yet. Monkey's are working on it!
This is release 0.5.0 of the MotorbotMusicAPI which gives you access to the basic endpoints to allow the handling of music/media within Motorbot. This API is constantly being updated along with the documentation so check back regularly to look for any changes.