Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove index column when export file in R

Tags:

r

I am using R programming to export a .dat file. but the exported file is always included the index column. Is there any possible way/ code to export data in R without index column?

like image 537
user3702909 Avatar asked Jun 03 '14 12:06

user3702909


People also ask

How do I remove a column by index in R?

2.1 Remove Column by Index This notation takes syntax df[, columns] to select columns in R, And to remove columns you have to use the – (negative) operator. The following example removes the second column by Index from the R DataFrame.

How do I write a csv file in R Without index?

Now let us see how these indices can be removed, for that simply set row. names parameter to False while writing data to a csv file using write. csv() function. By Default, it will be TRUE and create one extra column to CSV file as index column.

How do I remove an index in R?

To delete an item at specific index from R Vector, pass the negated index as a vector in square brackets after the vector. We can also delete multiple items from a vector, based on index.

How do I remove a specific column in R?

The most easiest way to drop columns is by using subset() function. In the code below, we are telling R to drop variables x and z. The '-' sign indicates dropping variables. Make sure the variable names would NOT be specified in quotes when using subset() function.


1 Answers

Lets say you are using write.table and your dataset is df then following will work for you

write.table(df,'df.dat',row.names=F)
like image 105
vrajs5 Avatar answered Oct 30 '22 07:10

vrajs5