Identify object in R

+1 vote

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 Sahiti
• 6,370 points
437 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, 2019 by anonymous
• 33,030 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 Sahiti
• 6,370 points
604 views
+1 vote
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,840 points
4,683 views
+1 vote
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
• 52,360 points
458 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 18, 2017 in Data Analytics by Sudhir
• 1,610 points
760 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,660 points
832 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,660 points
5,541 views
0 votes
1 answer

Left Join and Right Join using "dplyr"

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

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
853 views
+1 vote
2 answers

How to sort a data frame by columns in R?

You can use dplyr function arrange() like ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 33,030 points
1,442 views
+4 votes
3 answers

How to sum a variable by group in R?

You can also try this way, x_new = ...READ MORE

answered Aug 1, 2019 in Data Analytics by Cherukuri
• 33,030 points
77,320 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP