Publications by Will

2024/11/1

01.11.2024

Statistic <- c(68,85,74,88,63,78,90,80,58,63) Math <- c(85,91,74,100,82,84,78,100,51,70) plot(Statistic,Math, pch=15, col="blue", main ="班上的統計與數學分數", xlab="統計分數", ylab="數學分數") hist(Statistic, col= "purple", main ="班上的統計分數", xlab ="統計分數", ...

31 sym R (2423 sym/24 pcs) 4 img

Document

25.10.2024

Hi weight <- c(60,90,80,100,65,75,85,90) high <- c(150,156,158,162,170,185,180,175) plot(weight,high) data<- c(30,60,40,48) labels <- c("中文系","法文系","德文","翻譯") pie(data,labels,main ="學生的比例", col=cm.colors(length(data))) median(weight) ## [1] 82.5 mean(weight) ## [1] 80.625...

14 sym 2 img

Document

27.09.2024

tiltie tiltie 1 2 Will 2024/9/27 1 2 嗨 knitr::include_graphics("D:/2.jpg") ## Warning in knitr::include_graphics("D:/2.jpg"): It is highly recommended to use ## relative paths for images. You had absolute paths: "D:/2.jpg"...

64 sym 1 img

Document

25.10.2023

# Cargar bibliotecas library(shiny) library(randomForest) ## randomForest 4.7-1.1 ## Type rfNews() to see new features/changes/bug fixes. # Cargar conjunto de datos Iris data(iris) # Crear modelo de bosques aleatorios set.seed(123) model <- randomForest(Species ~ ., data = iris, ntree = 100) # Definir la interfaz de usuario (UI) ui <- flu...

89 sym R (3458 sym/22 pcs)

R Snippet for Sampling from a Dataframe

27.07.2009

It took me a while to figure this out, so I thought I’d share. I have a dataframe with millions of observations in it, and I want to estimate a density distribution, which is a memory intensive process. Running my kde2d function on the full dataframe throws and error — R tries to allocate a vector that is gigabytes in size. A r...

815 sym

Mapping SNPs to Genes for GWAS Enrichment Analysis

30.06.2011

There are several tools available for conducting a post-hoc analysis of GWAS data looking for enrichment of significant SNPs using literature or pathway based resources. Examples include GRAIL, ALLIGATOR, and WebGestalt among others (see SNPath R Package). Since gene enrichment and pathway analysis essentially evolved from methods ...

5193 sym 2 img

A New Dimension to Principal Components Analysis

27.10.2011

In general, the standard practice for correcting for population stratification in genetic studies is to use principal components analysis (PCA) to categorize samples along different ethnic axes.  Price et al. published on this in 2006, and since then PCA plots are a common component of many published GWAS studies.  One key advantage to using...

5040 sym 14 img

R Markdown to other document formats

26.12.2012

Perhaps you have a file written in Markdown with embedded R of the kind that RStudio makes so nice and easy but you’d like a range of output formats to keep your collaborators happy.  Say latex, pdf, html and MS Word.  Here’s what you might do I shall imagine your file is called doc.Rmd Install pandoc http://code.google.com/p/pandoc/down...

1672 sym R (2116 sym/4 pcs)

Unicode in R packages (not)

01.01.2013

Perhaps you are trying to add your nice new object as data for an R package. But wait. It has [gasp] foreign letters in its dimnames, so ’R CMD check’ will certainly complain. What you need is something to turn R’s natural Unicode-processing goodness into a relic from the early days of computing without inadvertently aliasing any words t...

904 sym R (129 sym/2 pcs)

Querying an SQLite database from R

06.01.2013

You have an SQLite database, perhaps as part of some replication materials, and you want to query it from R. You might want to be able to say: results <- runsql("select * from mytable order by date") and get the results back as an R object. Here's a function to do it. In the following, I'm going to assume the database is called mydatabase.db. ...

1234 sym R (418 sym/3 pcs)