Just finished a Coursera data science course. In one of the assignments, we need to clean up the weather event types. I was struggling with the grep function. For example, I want to find the event types which have “strong wind” in them, but I want to exclude “marine strong wind”. Finally found one example online, which uses the ?! in Perl to exclude matches. Here is one example:
events <- c("Strong Wind", "Wind", "Marine Strong Wind")
events[grep("^(?=.*strong.wind)", events, ignore.case = T, perl = T)]
##  "Strong Wind" "Marine Strong Wind"
events[grep("^(?=.*strong.wind)(?!.*marine)", events, ignore.case = T, perl = T)]
##  "Strong Wind"
The first grep function finds any strings with strong wind in them and it finds both “Strong Wind” and “Marine Strong Wind”. In order to exclude the “Marine Strong Wind”, we use (?!.*marine) as part of the argument to the grep function.
After I upgraded my Asus X205TA to Windows 10, I found that I only have a few MB left on the system drive. I had to delete the temporary previous version of Windows to save disk space. The system even reminds you to do so. If you did not see the prompt, follow these instructions:
- Click on the Windows button
- Type storage
- Click on Storage
- Click on This PC (C:)
- Scroll down and click on Temporary Files
- Scroll down and click on Delete previous versions
- Click on Delete
If the Storage settings does not appear in the search results. You can click on Windows button and click on Settings. Type storage in the Find a setting box on the top right corner. After the Storage settings is found, just follow the steps 3 to 7 to delete the previous version of Windows.
There are times when you want to reset your PC. On Windows 8, it’s two different tools. Refresh PC keeps your personal files while Reset PC delete personal files and reset the PC to factory state. On Windows 10, there is one tool called Reset this PC with two options. Here are the steps.
- Click on Windows button.
- Type reset.
- Click on Reset this PC.
- Click on Get started.
- Click on Keep my files or Remove everything.
- Click on Reset.
If you are like me who cannot wait for the notification of Windows 10 download, you can upgrade your Win 7 or 8 machines to Win 10 now. Before you begin, make sure you have at least 16GB of free disk space on a 32bit machine or 20GB for a 64bit machine.
Download the media creation tool from this link.
Double click on the downloaded file and follow the instructions to upgrade your machine.
Windows 10 uses the same command line utility slmgr as Windows 7 for activation with a MAK (Multiple Activation Key). Follow these simple steps to activate your Windows 10.
- Open up an elevated command prompt.
- Enter the following
slmgr -ipk your-mak-key-here
That’s it. To learn more about this command, type the following command.
Just installed the Windows 10 Insider Preview and tried to run an Elevated Command Prompt for the first time. I found that it’s the easiest since Windows 7. Step by step instructions:
- Move the cursor to the Windows button and right click.
- Select Command Prompt (Admin).
- Click on OK.