desctools

Winsorizing across all columns in a data frame (R) using `lapply`

会有一股神秘感。 提交于 2019-12-10 19:03:25
问题 I am trying to apply the Winsorize() function using lapply from the library(DescTools) package. What I currently have is; data$col1 <- Winsorize(data$col1) Which essentially replaces the extreme values with a value based on quantiles, replacing the below data as follows; > data$col1 [1] -0.06775798 **-0.55213508** -0.12338265 [4] 0.04928349 **0.47524313** 0.04782829 [7] -0.05070639 **-112.67126382** 0.12657896 [10] -0.12886632 > Winsorize(data$col1) [1] -0.06775798 **-0.37884540** -0.12338265

How to create a grid of spatial points

旧巷老猫 提交于 2019-11-29 03:06:09
问题 library(reshape2) library(data.table) library(dplyr) library(magrittr) library(ggplot2) library(scales) library(gstat) library(DescTools) library(sp) #I want a colorado grid# data("colorado.grid") #making cordinates into spatial points dataframe# coordinates(Gold_tracer_kri) <- ~ long_orig + lat_orig #attempt at kriging but no grid# lzn.kriged <- krige(Au ~ 1, Gold_tracer_kri, colorado.grid, model=lzn.fit) lzn.kriged %>% as.data.frame %>% ggplot(aes(long_orig=long_orig, lat_orig=lat_orig)) +