ds.asCharacter {dsBaseClient}R Documentation

Turns a vector into character type vector

Description

This function is similar to R function as.character.

Usage

ds.asCharacter(x = NULL, newobj = NULL, datasources = NULL)

Arguments

x

a character, the name of the input vector.

newobj

the name of the new vector.If this argument is set to NULL, the name of the new variable is the name of the input variable with the suffixe '_char'.

datasources

a list of opal object(s) obtained after login in to opal servers; these objects hold also the data assign to R, as dataframe, from opal datasources. By default an internal function looks for 'opal' objects in the environment and sets this parameter.

Details

See details of the R function 'as.character'.

Value

nothing is returned to the client, the new object is stored on the server side.

Author(s)

Gaye, A.

See Also

ds.asNumeric to turn a variable into a numeric type.

ds.asFactor to turn a variable into a factor type.

ds.asMatrix to coerce an object into a matrix type.

ds.asList to construct an object of type list.

Examples

{

  # load that contains the login details
  data(logindata)

  # login and assign specific variable(s)
  # (by default the assigned dataset is a dataframe named 'D')
  myvar <- list("GENDER")
  opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar)

  # turn the factor variable 'GENDER' into a character vector
  ds.asCharacter(x='D$GENDER', newobj="gender_char")

  # clear the Datashield R sessions and logout
  datashield.logout(opals)

}

[Package dsBaseClient version 4.1.0 ]