Identify object in R

0 votes

I'm facing a problem of identifying the output data type. If I'm expecting a list, it ends up being a list of lists or a data frame. What's a good method or workflow for figuring out the output data type when first using a function?

Jun 7, 2018 in Data Analytics by darklord
• 6,140 points
19 views

1 answer to this question.

0 votes

Hi, 

You can use ? followed by the function() or class(variable) it can provide you the class (or data type) of the output it can return. 

It's not suggested to do so for every function you use, so you can try explicitly converting your output into the required data type for the functions or operations that you are performing.

Some function has a default return type of the output that it returns, except those few you can try converting others as long as the conversion is possible and valid.

You can use functions such as unlist()as.[array/character/data frame/Date], etc that are vailable in R for conversions. 

answered Jul 2 by anonymous
• 17,870 points

Related Questions In Data Analytics

0 votes
1 answer

Check if the object(variable) is defined in R

You can use the exists(): > exists("toFindUnknown") [1] FALSE > ...READ MORE

answered Apr 17, 2018 in Data Analytics by darklord
• 6,140 points
32 views
0 votes
1 answer

"Error in eval(ei, envir) : object 'RDX2' not found" when trying to source the code in R

This is a very common issue that ...READ MORE

answered Oct 30, 2018 in Data Analytics by Maverick
• 10,040 points
358 views
0 votes
1 answer

How to check if object is defines in R?

You can use the exists function for ...READ MORE

answered Nov 6, 2018 in Data Analytics by Kalgi
• 37,430 points
22 views
0 votes
1 answer
0 votes
1 answer

Big Data transformations with R

Dear Koushik, Hope you are doing great. You can ...READ MORE

answered Dec 17, 2017 in Data Analytics by Sudhir
• 1,610 points
35 views
0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,550 points
48 views
0 votes
1 answer

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,550 points
79 views
0 votes
1 answer

Left Join and Right Join using "dplyr"

The below is the code to perform ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,550 points
82 views
0 votes
1 answer

Difference between List(list1,list2) and c(list1,list2) in R

Hi Deepa, It's quite simple, let me explain ...READ MORE

answered Jun 26 in Data Analytics by Cherukuri
• 17,870 points
38 views
0 votes
1 answer

Show a list of all variables in R

Hi Swathi, You can use ls() to list ...READ MORE

answered Jun 27 in Data Analytics by Cherukuri
• 17,870 points
27 views