0

I want to use functions in column class of SparkR, but I can't find the detail explanation of functions like cbrt, hypot or like. Typing ?cbrt will return useless information.

Anywhere I can find details of the these column functions?

Bamqf
  • 3,382
  • 8
  • 33
  • 47

1 Answers1

1

Good place to start is usually an official API documentation. If some function is not properly documented for a language you use you it's worth a try to check if a documentation for an another language (Python, Scala) doesn't provide a better explanation:

  • cbrt - computes the cube-root of the given value
  • hypot - computes sqrt(a^2 + b^2)
  • like - is equivalent to SQL LIKE operator

df <- createDataFrame(sqlContext,
    data.frame(x=c("foo", "bar", "foobar"), y=c(1, 8, 27), z=c(-1, 5, 10)))

select(df, df$y, cbrt(df$y)) %>% head()

##    y CBRT(y)
## 1  1       1
## 2  8       2
## 3 27       3

select(df, hypot(df$y, df$z)) %>% head()

##   HYPOT(y, z)
## 1    1.414214
## 2    9.433981
## 3   28.792360

select(df, df$x, like(df$x, "%ar"), like(df$x, "foo%")) %>% head()

##        x (x LIKE %ar) (x LIKE foo%)
## 1    foo        FALSE          TRUE
## 2    bar         TRUE         FALSE
## 3 foobar         TRUE          TRUE
zero323
  • 322,348
  • 103
  • 959
  • 935