layout | title |
---|---|
post |
Another test post |
OK so here is my idea about How these post snippets could work. could work.
In this snippet we address the problem: ...
# turn the data into a correlation matrix | |
cor(mydata) | |
# perform the PCA, using `principal` | |
pca.fit <- principal(mydata, | |
nfactors = ncol(mydata), # the number of factors = the number of columns in my data | |
rotate = "varimax", # I want to perform varimax rotation on the factors | |
residuals = TRUE, # report the residuals | |
scores = TRUE) # find the component scores |
mi:::.create.missing | |
function (data, pct.mis = 10) | |
{ | |
n <- nrow(data) | |
J <- ncol(data) | |
if (length(pct.mis) == 1) { | |
n.mis <- rep((n * (pct.mis/100)), J) | |
} | |
else { | |
if (length(pct.mis) < J) |
```{r global_options, include=FALSE, cache=FALSE} | |
library(knitr) | |
# Set basic options. You usually do not want your code, messages, warnings etc. | |
# to show in your actual manuscript however for the first run or two these will | |
# be set on. | |
opts_chunk$set(echo=FALSE, | |
warning=FALSE, | |
message=FALSE, | |
cache = TRUE, | |
include = FALSE, |
Serial study of factors influencing changes in cardiac output during human pregnancy | 557 | 1989 | |
---|---|---|---|
Bayesian inference for a discretely observed stochastic kinetic model | 172 | 2008 | |
159 | 1992 | ||
151 | 1996 | ||
150 | 1987 | ||
127 | 1992 | ||
126 | 1992 | ||
97 | 1996 | ||
95 | 2003 | ||
94 | 1991 |
# assuming data has columns named something like: "lat", "long", and "timestamp" | |
library(ggmaps) | |
library(ggplot2) | |
ggplot(data = data, | |
aes(x = lat, | |
y = long)) + | |
geom_point() + |
#' meteo_distance | |
#' | |
#' @description | |
#' | |
#' @param data a dataframe. Expects col headers with names latName and longName | |
#' @param lat Latitude to centre search at | |
#' @param long Longitude to centre search at | |
#' @param latName Name of latitude header name in data, Default = 'latitude' | |
#' @param longName Name of longitude header name in data. Default = 'longitude' | |
#' @param units Units of the latitude and longitude values: degrees 'deg', radians 'rad', d/m/s 'dms'. Default = 'deg' |
context("Test names with spaces") | |
messy_names <- data_frame(`Sepal Width` = iris$Sepal.Width, | |
`Sepal Length` = iris$Sepal.Length, | |
`Petal Length` = iris$Petal.Length, | |
`Species Names` = iris$Species) | |
test_that("vis_dat works on dataframes with irregular variable names", { | |
expect_success( | |
vis_dat(messy_names) |
# calculate if there has been a smoker in the past | |
# "smoked_previously" | |
data_prac <- data_frame(ID = c(1, 1, 1, 1, | |
201, 201, | |
342, 342, 342, | |
613, 613, 613, 613, 613), | |
time = c(1, 2, 3, 4, | |
1, 2, |
library(microbenchmark)
library(wakefield)
library(visdat)
mb1 <-
microbenchmark(vis_dat(airquality),
table_heat(airquality))
boxplot(mb1)