All functions

mf_bib()

Create a bib file for R packages, including the citations of userdefined packages. 
mf_convertc()

Convert air concentration between ppm and micromol m3 
mf_convertRH()

Convert the unit of air humidity according to Sonntag 1990. a in g/m3 , RH in %, q in kg/kg. 
mf_daynight()

Define daytime or nighttime 
mf_dfplot()

Plot a dataframe, multiple ys against one x 
mf_dfplot2()

Plot a dataframe, one y against multiple xs 
mf_errorbar()

add error bars to a scatterplot. 
mf_fillna()

Fill a time series with NAs. in: a dataframe and a timestamp vector. out: a dataframe. 
mf_findpeaks()

Find peaks of a curve
#https://rtricks.wordpress.com/2009/05/03/analgorithmtofindlocalextremainavector/ 
mf_findpeaks2()

Find peaks of a curve
http://stackoverflow.com/questions/31220307/calculatexvalueofcurvemaximumofasmoothlineinrandggplot2 
mf_hist()

Plot a usercustomized hist 
mf_hmplot()

Plot a Hovmoeller or fingerprint plot 
mf_hourrose()

Hour rose plot 
mf_imagescale()

Create a legend 
mf_kurtosis()

Kurtosis measures whether the data are peaked or flat relative to a normal curve. positive: wide. negative: narrow 
mf_list2ascii()

Save a list into an ASCII file. in: a list. out: a file. 
mf_lm()

plot a linear regression figure and return a list of parameters. in: two vectors. out: a figure and a list. 
mf_lmdf()

calculate linear regression between every two columns in a data frame. in: a dataframes. out: a dataframe showing the linear regression. 
mf_names()

Enhancement of names() 
mf_optimdmodel()

optim function for the dmodel in chamber flux calculation. in: initial values for optim function. out: best fitted parameters 
mf_outlier()

check outliers. in: a vector. out: a plot and a vector of flags. the blank flag means passing all checks. 
mf_pairs()

plot pairwise correlations. in: a dataframe. out: a figure. 
mf_pairs2()

plot pairwise correlations with p value. in: a dataframe. out: a figure. 
mf_pairslm()

plot pairwise correlations with linear regression. in: a dataframe. out: a figure. # not done yet. 
mf_pickquantile()

A filter to pick out data within a range by quantile of ref. in: a numeric vector. out: a logical vector. 
mf_planarfit()

calculate the planafit coefficients from 3D wind measurement. in: three vectors or onecolumn dataframes. out: a list. 
mf_plotblank()

plot a blank figure 
mf_plotcolors()

A reminder for colors 
mf_plotlty()

lty 
mf_plotpch()

pch numbers 
mf_plottype()

type 
mf_prefix0()

fill 0 before a string. in and out: a vector with length 1. if length(x) > 1, use unlist(lapply(x,FUN = mf_fill0)). e.g. 12  012 
mf_rainbow()

# give each x a color by groups. 
mf_readdir()

batch read several files. in: a path. out: a list containing all data frames 
mf_satpress()

calculation of saturation vapour pressure (Pa) at T(degree C). in and out: a vector. for 45 to 60 degree over water according to Sonntag 1990 
mf_se()

standard error 
mf_sharedata()

A template to create a folder with data files to share 
mf_skewness()

normality test. if either skewness/se_skew is outside 1.96  1.96, the data are unlikely to be normally distributed. Or KolmogorovSmirnov test, ShapiroWilks' W test. But a visual examination is the best. Negative values of the skewness indicate data that are skewed to the left(negativelz skewed) 
mf_smooth()

smooth a series with a giving width. in and out: a vector. 
mf_strptime()

A simplied version of strptime. only for '%Y%m%d %H:%M:%S' 
mf_sunriset()

calculate sunrise and sunset time in a friendly way. in: a given date and coordinates. out: a dataframe with sunrise and sunset time. 
mf_tapply()

a friendly version of tapply for dataframes. in and out: same as tapply(). the builtin function tapply returns a matrix with unfriendly row name and colname. mftapply returns a friendly dataframe 
mf_taylor()

mf_taylor: plot a taylor diagram to compare reference (x) and model (y). in: two vectors. out: a figure. 
mf_timefiller()

Fill time series with NA 
mf_timestampfull()

convert time stamps into a full format, i.e.
convert 20160714 or 20160714 00:00 into 20160714 00:00:00
convert 14.07.2016 or 14.07.2016 00:00 into 14.07.2016 00:00:00
convert 14.07.2016 or 14.07.2016 00:00 into 14.07.2016 00:00:00
convert 20160714 or 2016071400 or 201607140000 into 20160714000000 
mf_vtapply()

a friendly version of tapply 
mf_windd()

calculate resultant wind direction from u and v. in: a vector of u and v. out: a vector of wind direction. 
mf_winddclear()

convert wind direction out of the range [0, 360) into the range. 
mf_windmean()

calculate resultant mean wind spead and resultant mean wind direction.# in: a wind speed vector and a wind direction vector. # out: a mean speed and a mean direction. 
mf_windmean2()

not recommended! alculate resultant mean wind speed and resultant mean wind direction. especially used in tapply(). this calc is sometimes confusing. better to calc step by step. in: a character vector with wind speed and direction separated with semi colon ';'. out: a chracter vector with resultant mean wind speed and resultant mean direction separated with semi colon ';'. 
mf_windrose()

Draw my windrose 
mf_windu()

calculate u component of wind. in: a vector of wind speed and a vector of wind direction. out: a vector of u 
mf_windv()

calculate v component of wind. in: a vector of wind speed and a vector of wind direction. out: a vector of v 
mf_write()

save csv file with asking if the file already exists. 