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
• 16,220 points
23 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
• 42,280 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 in Data Analytics by anonymous
7,621 views
+1 vote
2 answers
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 in Data Analytics by anonymous
• 31,840 points
146 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 Anmol
• 3,620 points
70 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 Anmol
• 3,620 points
37 views
0 votes
1 answer

Remove NA values from the output in R programming

Edit your code: columnmean <- function(x, removeNA = ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 42,280 points
49 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
• 42,280 points
59 views
0 votes
2 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
• 42,280 points
58 views