Ask Sawal

Discussion Forum
Notification Icon1
Write Answer Icon
Add Question Icon

Caoilinn Pani




Posted Answers



Answer


In this lesson, you’ll learn how to create sequences of numbers in R. Sequences of numbers are used in many different tasks, from plotting the axes of graphs to generating simulated data.

The simplest way to create a sequence of numbers in R is by using the : operator. Type 1:20 to see how it works.

That gave us every integer between (and including) 1 and 20 (an integer is a positive or negative counting number, including 0).

We could also use it to create a sequence of real numbers (a real number is a positive, negative, or 0 with an infinite or finite sequence of digits after the decimal place). For example, try typing pi:10.

The result is a vector of real numbers starting with pi (3.142…) and increasing in increments of 1. The upper limit of 10 is never reached, since the next number in our sequence would be greater than 10.

Note also that pi is one of the few constants built in to R. Type ?pi to check the others.

What happens if we do 15:1? Give it a try to find out.

It counted backwards in increments of 1! This is sometimes useful for plotting coefficients from models in reverse order.

Remember that if you have questions about a particular R function, you can access its documentation with a question mark followed by the function name: ?function_name_here. However, in the case of an operator like the colon used above, you must enclose the symbol in backticks like this: ?:. (NOTE: The backtick (`) key is generally located in the top left corner of a keyboard, above the Tab key. If you don’t have a backtick key, you can use regular quotes.)

Pull up the documentation for : now.

Often, we’ll desire more control over a sequence we’re creating than what the : operator gives us. The seq() function serves this purpose.

The most basic use of seq() does exactly the same thing as the : operator. Try seq(1, 20) to see this.

This gives us the same output as 1:20. Check the help file for seq().

The help files show the arguments listed for the seq() function. The first two arguments are “from =” and “to =”. In R, you do not have to specify the arguments by name if you write out their values in the same order as written in the function. However, for complex functions it is often best practice to do so and makes your code much clearer.

For example, seq(from = 1, to = 20) will give the same output as seq(1, 20). Try it!

OK, let’s say that instead of 1 to 20, we want a vector of numbers ranging from 0 to 10, incremented by 0.5. seq(0, 10, by = 0.5) does just that. Try it out.

Or maybe we don’t care what the increment is and we just want a sequence of 30 numbers between 5 and 10. seq(5, 10, length = 30) does the trick. Give it a shot now and store the result in a new variable called my_seq.

If you look closely again at the help file for ?seq, you will not see an argument “length =”, but only “length.out =”. You can actually use any abbreviation of the argument name, as long as it is different from any other argument. You could even use just “l =”!

To confirm that my_seq has length 30, we can use the length() function. Try it now. To do this, you need to include the object ‘my_seq’ as the value of argument ‘x’ of length().

Let’s pretend we don’t know the length of my_seq, but we want to generate a sequence of integers from 1 to N, where N represents the length of the my_seq vector. In other words, we want a new vector (1, 2, 3, …) that is the same length as my_seq.

There are several ways we could do this. One possibility is to combine the : operator and the length() function like this: 1:length(my_seq). Give that a try.

Another option is to use seq(along.with = my_seq). Give that a try.

However, as is the case with many common tasks, R has a separate built-in function for this purpose called seq_along(). Type seq_along(my_seq) to see it in action.

There are often several approaches to solving the same problem, particularly in R. Simple approaches that involve less typing are generally best. It’s also important for your code to be readable, so that you and others can figure out what’s going on without too much hassle.

If R has a built-in function for a particular task, it’s likely that function is highly optimized for that purpose and is your best option. One of the philosophies of R (and Unix more generally) is to have tools (or functions) that do specific things very well and then link these together, rather than a single multi-purpose tool that does many things poorly.

This approach is like having a seperate knife, fork, and spoon, rather than a Spork … In most situations, cutlery (“silverware”) is superior to the Spork.

As you become a more advanced R programmer, you will learn how to link and nest these apparently simple functions to do incredibly powerful tasks. You will also design your own functions to perform tasks when there are no better options. We’ll explore writing your own functions in future lessons.

OK, back to the show. One more function related to creating sequences of numbers is rep(), which stands for ‘replicate’. Let’s look at a few uses.

If we’re interested in creating a vector that contains 40 zeros, we can use rep(0, times = 40). Try it out.

If instead we want our vector to contain 10 repetitions of the vector (0, 1, 2), we can do rep(c(0, 1, 2), times = 10). Go ahead.

Finally, let’s say that rather than repeating the vector (0, 1, 2) over and over again, we want our vector to contain 10 zeros, then 10 ones, then 10 twos. We can do this with the each argument. Try rep(c(0, 1, 2), each = 10).

Congratulations! Now you have several powerful tools that you can use to generate sequences of numbers. You also learnt to use the function length() and the ‘:’ operator. Your R skills are building!

Please submit the log of this lesson to Google Forms so that Simon may evaluate your progress.


Answer is posted for the following question.

How to sequence in r?

Answer


You can easily track your LBC package from anywhere in the world using Trackingmore. Irrespective of your location, order size or order destination, Trackingmore makes it possible for you to get accurate information on your order status and the location of your package at each point of delivery.

Step 1:

Go to https://www.trackingmore.com/lbcexpress-tracking.html

Step 2:

Type in the LBC Express tracking number in the field provided and click “Track.”

Done! Your extensive LBC Express package information will be displayed on the next page.

Alternatively, you can track your LBC package by visiting the “Track and Trace” page of the LBC website and inputting the tracking number.

LBC offers both local and international shipping services

LBC Local Shipping:

This shipping category caters to shipping or courier services within the Philippines. Parcels like documents, gadgets, photos, or certificates are easily transported via this category, as well as various value-added options that customers can subscribe to within this range.

LBC local shipping also offers a service called 10 am pickup, where a small fee of P50 can be added to the regular service fee to make your orders ready for pickup at any LBC office of your choice at exactly 10 am the next day.

LBC International Shipping:

Through LBC Express International Padamas, LBC facilitates delivery services to customers all over the world outside the Philippines. You can send documents, parcels, gadgets, letters, and so on to over 250 destinations with the X Pouch and X Pack sizes available.

LBC has a unique tracking number format that makes it easy to recognize or identify their packages. The tracking number is made up of 12 digits arranged into four groups of three digits per group. For example, 123 456 789 012

LBC shipping rates vary owing to the delivery option you go for.

LBC offers various shipping options under the international and local shipping categories. Each of these options has its own shipping rates as shown below.

LBC International Shipping:

There are three products under this category, which are the X Cargo, X Pack, and X Pouch.

LBC Local Shipping:

There are many shipping products in this category and all of them have different rates. They include; Cargo Day 1, Cargo KB XI, Cargo KB large, Cargo KB medium, Cargo KB mini, Cargo KB slim, Cargo KB small, Cargo N-Pack large, Cargo N-Pack small, Courier N-Pouch regular, Courier N-Pouch SS, Courier N-Pouch XL, and Courier V-Pouch.

You can check their website for a comprehensive list of their shipping rates according to your preferred shipping option and delivery destination.

COD simply means Cash on Delivery, while COP means Cash on Pick Up. LBC Express offers its customers these befitting payment options to make the customer experience more convenient and to buttress their resolve to provide excellent customer service.

LBC Pickup is available in other locations aside from Metro Manila. Places like Cebu, Cagayan de Oro, Iloilo, and Davao del Sur have LBC Pickup Centres.

LBC Pick Up is a service that enables LBC to pick up packages from customers’ addresses to be delivered to the other party, as opposed to the regular practice of having customers drop off packages at the LBC office.

It is easy to interchange LBC “tracking number” for LBC “booking number”. “Track and Trace is used only to track packages. In order to do this, you must make use of the LBC tracking number, not the booking number. If you input the booking number or any other number that is not the tracking number, you will get the error message “invalid number”.

Tel  : +63 800-10-8585999

TrackingMore is a third party parcel tracking tool (also known as a multi-carrier tracking tool) that supports online parcel tracking of worldwide 477 express and postal couriers. You can enter a tracking number, air waybill (AWB) number, or reference number to track & trace a single international or domestic package, use CSV upload or restful shipment tracking API to track multiple packages.

If you check the statuses of bulk international parcels shipping via LBC Express, TrackingMore will display all tracking details in one place, from both the origin country and the destination country.

You can subscribe to email delivery notifications on the LBC Express shipping tracking result page to auto-send you alerts once there is an update on your order status.

If you want to find explanations of a specific tracking event, you can refer to "Tracking Status descriptions & suggestions".

Trackingmore provides real-time details of your LBC Express package and supports multiple languages like English, French, Spanish, German, and more.

1. Shipment Tracking Management:

a. Auto tracking and delivery notification: after logging in, you can set up the "Notification Settings", and the system will auto-track your LBC Express waybills and notify customers when in transit, pick up, delivered, or exceptions.

b. Compatible with eBay / aliexpress / Magento: with your eBay,aliexpress, and Magento account bounding to trackingmore,our system will collect the data together, so you can manage your shipments in one place.

2.multi-language support: Support sixteen different languages, so it's convenient for users from different countries.


Answer is posted for the following question.

how to track lbc?

Answer


Smoked Paprika

Address: 2/5 Nash St, Paddington QLD 4064, Australia


Answer is posted for the following question.

Which is the best sunday brunch in Brisbane, Australia?

Answer


Braddon Rugby League Park

Address: 28 Torrens St, Braddon ACT 2612, Australia


Answer is posted for the following question.

Where could I locate best rugby league schools in Canberra, Australia?

Answer


Treatment for chlamydia, gonorrhea, or another STD may be successful, but it does not protect you from other STDs in the future In fact, many people become infected with STDs over and over again This is because they have unprotected sex with partners who have untreated STDs


Answer is posted for the following question.

Why did my std come back?


Wait...