R

Control flow in R

Masumbuko Semba
R
One of the prime purposes of using a computer is to automate a task that would be very tedious to perform by hand. The usual implication is that some task is to be performed over and over again in some systematic way. This chapter will be concerned with the programming concept of a control flow, a feature that is at the heart of nearly every computer algorithm. The two important control flows statements are* count-controlled* loops like for loops and conditional statements such as if-else construct.

Time interval with lubridate in R

Masumbuko Semba
R
Time Interval You can save an interval of time an an interval object in R with lubridate. This is quite useful for example, you want to understand the interval between two or more successive CTD casts algoa = list.files("d:/semba/CTDs/algoa/processing/updown files/", pattern = "dst", full.names = TRUE) we notice that the files has an .cnv extenstion, which is oce–readable. We therefore load the oce package together the package in tidyverse.

Familiarize with date and time of Argo Floats data with lubridate package

Masumbuko Semba
R
In this post we will learn to work with date and time data in R. We will use the lubridate package developed by Garrett Grolemund and Hadley Wickham ~@lubridate. This package makes it easy to work with dates and time. Let’s us load the packages that we will use require(lubridate) require(tidyverse) require(magrittr) require(oce) Data We will use the profiles data from Argo within the Indian Ocean. The data was downloaded from the Coriolis Global Data Assembly Center site (ftp://ftp.

Kernel smoothing of spatial data

Masumbuko Semba
R
Kernel density estimation is a popular tool for visualizing the distribution of data. In this post, we are going to look on how to create smoothed map of random points. We will use a shapefile dataset that contains potential fishing zones derived from sea surface temperature recorded between January and June 2020 in Pemba channel. You can simply download the file from this link. Once you have downloaded the file, unzip and browse in the uncompressed file you find the shapefile pfz.

Estimate the length at maturity of fish in R

Masumbuko Semba
R
An ogive (oh-jive), sometimes called a cumulative frequency polygon, is a type of frequency polygon that shows cumulative frequencies. In other words, the cumulative percents are added on the graph from left to right. An ogive graph plots cumulative frequency on the y-axis and class boundaries along the x-axis. It’s very similar to a histogram, only instead of rectangles, an ogive has a single point marking where the top right of the rectangle would be.