Questions tagged [read.csv]

The command in R to read a data file with a “comma separated values” (csv) format.

The read.csv is a command in R to read a data file with a “comma separated values” (csv) format.

737 questions
-1
votes
1 answer

difference between as.data.frame and read.csv in R

I would like to do Propensity Score Match with R function matchit, if I read data from a csv file, eveything looks fine and result is what I want: > csv <- read.csv("C:/Users/Lenovo/Desktop/ddd.csv", header=TRUE) > df <- as.data.frame(csv) > df …
allen lei
  • 11
  • 1
  • 2
-1
votes
1 answer

How can I export my data as a png using R

Edit: adding link to the data being used (https://drive.google.com/open?id=0B0PKu0-SX1JPRW94SXFybFd6N2c) Before I begin, I apologize if this is a duplicate but I cannot seem to find the answer after hours of research (though it likely exists...). I…
-1
votes
1 answer

passing data frames in R bind

ULTRON <- function(directory, pollutant, id = 1:332) { files_full <- list.files(directory, full.names = TRUE) dat <- data.frame() for (i in id) { dat <- rbind(dat, read.csv(files_full[i])) …
-1
votes
1 answer

Spliting a row into columns using a delimiter in R

My data loks like this: ID:10:237,204, ID:11:257,239, ID:12:309,291, ID:13:310,272, ID:14:3202,3184, ID:15:404,388, I would like to first separate this into different columns then apply a function on each row to calculate the difference of comma…
Hiesenberg
  • 415
  • 1
  • 8
  • 12
-1
votes
1 answer

R's read.csv() breaks data to fit the console's width

I use read.csv() to import data to R. The problem is that R fits the console's width and I get all my data in several levels. I need all my data together and be able to scroll through it with the scroll bar. Is it possible?
-2
votes
1 answer

Why does read.csv read NAs values into a file as character variables?

I need to count the NAs elements in a CSV file containing numeric values and NAs. Using read.csv, r automatically reads them all as character, therefore it's impossibile to detect how many NAs there are. How can i fix that?
-2
votes
1 answer

swift read xls(excel) content + Hindi + Gujarati Character Encoding issue

read xls(Excel) file with non english character(**not xlsx file) i have tried all the encoding option but i am unable to read xls file content. let data = try Data(contentsOf: url)// Document Directory file path let dataEncoded = String(data: data,…
-2
votes
2 answers

Exporting the first blank row of csv file as a blank row after exporting to text file in MATLAB

I have a csv file of dimension 26299*150, where the first row is blank. While exporting each column as text file the first blank row gets saved as '0' in the text file. I want it to be saved as a blank line in the first line of text file. Please…
ssd007
  • 13
  • 2
-2
votes
1 answer

Convert Factors to Numbers But Getting N/As for The Entire Column

First off, I have looked at all the examples and previous questions and have not been able to find a usable answer to my situation. I have a data set of 300ish independent variables I'm trying to bring into R. The variables are all classified as…
-2
votes
1 answer

reading csv file. different variables not detected

I have read loads of csv files into r. For some reason this file I am working on, with several variables is read as if it had only 1 variable. R loads it and adds it to the global environment, the number of rows is right, but there is only 1 column.…
Pepe
  • 1
  • 6
-2
votes
1 answer

Error while reading csv file

I have a xlsx file and to read from Rstudio i saved it as .csv file. Now when i try to read the file from Rstudio, receiving the below error. setwd("D:/DATA SCIENCE/CCPP-Linear regression") ccpp<- read.csv("Folds5x2_pp.csv", header = TRUE) Error…
-2
votes
2 answers

CSV file import in R

I am trying to import a CSV file into R to do fraud analysis with linear/logistic regression. What should have been pretty easy is turning complicated... This data set contains 26 variables and more than 2 million rows. I used this command line to…
NuValue
  • 453
  • 3
  • 11
  • 28
-3
votes
1 answer

How do I make grouped data and create variables in the heading when reading a data table?

I am trying to make a data table in R, where there is a heading with variables and a subheading with 4 "reps" grouped to each variable.. Here is a result of View(my.data) which was read from csv-file by my.data <- read.csv("DataTable.csv", header=T,…
Tine
  • 1
-3
votes
1 answer

subset() in R with $

I am trying to understand a quirk with the subset() function in R and the use of the $ operator. I'll use the CO2 dataset in R as an example: I can run sub <- subset(CO2, CO2$Type=="Quebec") without error to arrive at the same dataset as if I were…
-3
votes
1 answer

importing data into r that can not be as numeric

I use both read.csv and read.table for importing data as following, but it`s not as numeric.can you help me whats the problem? x<-read.csv("D:\\r-files\\mydata1.csv",header=TRUE,dec = ".") > is.numeric(x) [1]…
farzan
  • 1
  • 1
1 2 3
49
50