Install this theme
evaluate the calculated derivative
e <- expression(sin(x/2)*cos(x/4))
dydx <- D(e, "x")
#=> cos(x/2) * (1/2) * cos(x/4) - sin(x/2) * (sin(x/4) * (1/4))
 
z <- seq(-1,1,.1)
eval(dydx, list(x=z))
#=> [1] 0.3954974 0.4146144 0.4320092 0.4475873 0.4612640 0.4729651 0.4826267 0.4901964 0.4956329
#=> [10] 0.4989067 0.5000000 0.4989067 0.4956329 0.4901964 0.4826267 0.4729651 0.4612640 0.4475873
#=> [19] 0.4320092 0.4146144 0.3954974

Created by Pretty R at inside-R.org

how to make cross table using reshape2
library(reshape2)
library(plyr)
data(tips)
tips.m <- melt(
  tips, 
  id.vars = c("sex", "smoker", "day", "time"),
  mesure.vars = c("total_bill", "tip")
)
dcast(tips.m, sex + day~smoker, sum, subset = .(variable == "tip"))

Created by Pretty R at inside-R.org

     sex  day     No   Yes
1 Female  Fri   6.25 18.78
2 Female  Sat  35.42 43.03
3 Female  Sun  46.61 14.00
4 Female Thur  61.49 20.93
5   Male  Fri   5.00 21.93
6   Male  Sat 104.21 77.74
7   Male  Sun 133.96 52.82
8   Male Thur  58.83 30.58


library(scatterplot3d)
with(mtcars, {
    s3d &lt;- scatterplot3d(disp, wt, mpg,
                  color=cyl, pch=19,
                  type="h", lty.hplot=2,
                  scale.y=.75,
                  main="3-D Scatterplot Example 4",
                  xlab="Displacement (cu. in.)",
                  ylab="Weight (lb/1000)",
                  zlab="Miles/(US) Gallon")
     s3d.coords &lt;- s3d$xyz.convert(disp, wt, mpg)
     text(s3d.coords$x, s3d.coords$y,
          labels=row.names(mtcars),
          pos=4, cex=.5)
      # add the legend
      legend("topleft", inset=.05,      # location and inset
      bty="n", cex=.5,                  # suppress legend box, shrink text 50%
      title="Number of Cylinders",
      rownames(table(mtcars$cyl)), fill=mtcars$cyl)
})


Created by Pretty R at inside-R.org
library(scatterplot3d)
with(mtcars, {
    s3d <- scatterplot3d(disp, wt, mpg,
                  color=cyl, pch=19,
                  type="h", lty.hplot=2,
                  scale.y=.75,
                  main="3-D Scatterplot Example 4",
                  xlab="Displacement (cu. in.)",
                  ylab="Weight (lb/1000)",
                  zlab="Miles/(US) Gallon")
     s3d.coords <- s3d$xyz.convert(disp, wt, mpg)
     text(s3d.coords$x, s3d.coords$y,
          labels=row.names(mtcars),
          pos=4, cex=.5)
      # add the legend
      legend("topleft", inset=.05,      # location and inset
      bty="n", cex=.5,                  # suppress legend box, shrink text 50%
      title="Number of Cylinders",
      rownames(table(mtcars$cyl)), fill=mtcars$cyl)
})

Created by Pretty R at inside-R.org



library(scatterplot3d)
with(mtcars, {
  s3d &lt;- scatterplot3d(disp, wt, mpg,
                       color="blue", pch=19,
                       type="h")
  # convert 3D coords to 2D projects
  s3d.coords &lt;- s3d$xyz.convert(disp, wt, mpg)
  # x &amp; y coordinates, text to plot
  text(s3d.coords$x, s3d.coords$y, labels=row.names(mtcars), cex=.5, pos=4)
})


Created by Pretty R at inside-R.org
library(scatterplot3d)
with(mtcars, {
  s3d <- scatterplot3d(disp, wt, mpg,
                       color="blue", pch=19,
                       type="h")
  # convert 3D coords to 2D projects
  s3d.coords <- s3d$xyz.convert(disp, wt, mpg)
  # x & y coordinates, text to plot
  text(s3d.coords$x, s3d.coords$y, labels=row.names(mtcars), cex=.5, pos=4)
})

Created by Pretty R at inside-R.org

head(mtcars)
#                    mpg cyl disp  hp drat    wt  qsec vs am gear carb
# Mazda RX4         21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
# Mazda RX4 Wag     21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
# Datsun 710        22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
# Hornet 4 Drive    21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
# Hornet Sportabout 18.7   8  360 175 3.15 3.440 17.02  0  0    3    2
# Valiant           18.1   6  225 105 2.76 3.460 20.22  1  0    3    1


library(scatterplot3d)
with(mtcars, {
  scatterplot3d(disp, wt, mpg, main="3-D Scatter Plot sample")
})

head(mtcars)
#                    mpg cyl disp  hp drat    wt  qsec vs am gear carb
# Mazda RX4         21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
# Mazda RX4 Wag     21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
# Datsun 710        22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
# Hornet 4 Drive    21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
# Hornet Sportabout 18.7   8  360 175 3.15 3.440 17.02  0  0    3    2
# Valiant           18.1   6  225 105 2.76 3.460 20.22  1  0    3    1


library(scatterplot3d)
with(mtcars, {
  scatterplot3d(disp, wt, mpg, main="3-D Scatter Plot sample")
})