mercredi 30 août 2017

Using [] if statement

I have the following issue, I want to use the following piece of code inside my function, but it doesnt work:

object[logical] = matrix of length 32
object[logical2] = dataframe of length 35
object[logical3] = matrix of length 31
object[logical4] = dataframe of length 33

However I get an error that the object 'object' is not found. If I define the object before these statements, I am not able to set it to different values with different lengths. All the matrixes and data frames are composed of one row and columns with names. These names are necessary for the latter part of this function to work as intended.

How should I define the object before these statements? Is using a regular if statement slower than this kind of [] if?

I am concerned with speed as I am working with a big dataframe and the function will be used in the shiny application.

Also, in reality there are 28 different logicals.

thx in advance

Aucun commentaire:

Enregistrer un commentaire