as.data.frame not working expected

0 votes

I ran the following code to read data from a CSV file:

normData= read.csv("normData.csv");

and my normData looks like:

enter image description here

But When I ran the following code to form a Data Frame:

datExpr0 = as.data.frame(t(normData));

I get the following data:

enter image description here

from where the an extra raw (v1,v2,v3,v4,v5,v6) coming from?

Nov 5, 2018 in Data Analytics by Hannah
• 18,040 points
78 views

1 answer to this question.

0 votes

Try using:

setNames(as.data.frame(t(normData[-1])), normData[[1]])
answered Nov 5, 2018 by Kalgi
• 51,850 points

Related Questions In Data Analytics

0 votes
1 answer
0 votes
2 answers

Filtering R data-frame with multiple conditions

librarry(dplyr) dataset >%> filter((a ==1,b>15 ) | (a==2,b&g ...READ MORE

answered Aug 8, 2019 in Data Analytics by anonymous
21,585 views
+1 vote
2 answers

Finding number of missing values and removing those missing values from a data-frame

To find number of missing values for ...READ MORE

answered Aug 14, 2019 in Data Analytics by anonymous
121 views
0 votes
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
• 32,460 points
296 views
+9 votes
3 answers

Which is a better initiative to learn data science: Python or R?

Well it truly depends on your requirement, If ...READ MORE

answered Aug 8, 2018 in Data Analytics by Abhi
• 3,680 points
148 views
0 votes
1 answer

How can I perform word stemming in R

The tm package in R provides the stemDocument() function to stem the ...READ MORE

answered Aug 20, 2018 in Data Analytics by Abhi
• 3,680 points
185 views
0 votes
1 answer

How to know the type of an object?

To find the type of an object ...READ MORE

answered Sep 19, 2018 in Data Analytics by Abhi
• 3,680 points
56 views
0 votes
2 answers

In data frame how to spilt strings into values?

You can do this using dplyr and ...READ MORE

answered Dec 4, 2018 in Data Analytics by Kalgi
• 51,850 points
117 views
0 votes
3 answers

Which language should I learn when starting career as data scientist - R or Python

I'll put down a few parameters on ...READ MORE

answered Oct 26, 2018 in Data Analytics by Kalgi
• 51,850 points
120 views