Re: [R] Reading csv file with missing value

2016-06-24 Thread Bert Gunter
Read yesterday's and today's archives. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Jun 24, 2016 at 1:55 PM, Steven Yen wrote: > I read

[R] Reading csv file with missing value

2016-06-24 Thread Steven Yen
I read a csv file (with read.csv) containing missing values (as shown below). Is there a convenient way to set these NA into zeros? Better yet, is there an option to assign zeros to these blank cells in reading the csv file? Thank you! NA -1 NA NA NA 1 NA NA NA NA NA NA NA NA NA NA

Re: [R] Reading CSV file every time when R starts

2014-06-23 Thread MacQueen, Don
However, be careful, because .Rprofile runs before any saved .RData file is loaded. If the object you created in .Rprofile is later saved when you quit R, then the next time you start R, the saved version will replace the version created in .Rprofile. (Unless you start R using R --no-restore) This

Re: [R] Reading CSV file every time when R starts

2014-06-23 Thread Christofer Bogaso
Hi Greg, Thanks for your prompt reply. I have added 'library(utils)' in my Rprofile file and now it is working fine. Thanks and regards, On Mon, Jun 23, 2014 at 11:34 PM, Greg Snow <538...@gmail.com> wrote: > The .Rprofile file is processed before all the standard packages are > loaded, that is

Re: [R] Reading CSV file every time when R starts

2014-06-23 Thread Greg Snow
The .Rprofile file is processed before all the standard packages are loaded, that is why you are seeing the error. If you instead run the command as utils::read.csv or use library or require to manually load the utils package before calling read.csv then everything should work for you. On Mon, Ju

[R] Reading CSV file every time when R starts

2014-06-23 Thread Christofer Bogaso
Hi again, I am trying to build a procedure such that whenever R starts, it will read some CSV file. Therefore I put a code sometime like 'read.csv(...)' in my Rprofile file. However if I put this function there then I am getting an error saying 'Error: could not find function "read.csv"', wheneve

Re: [R] Reading CSV file

2013-04-19 Thread Bretschneider SIG-R
Dear Gafar Matanmi Oyeyemi, Re: > I am trying to read a csv file using the code; > contol <- read.csv("RBS.csv") > This is the error message I got; > Error in file(file, "r") : unable to open connection > In addition: Warning message: > In file(file, "r") : > cannot open file 'RBS.csv', reason '

Re: [R] Reading CSV file

2013-04-19 Thread Charles Determan Jr
Are you sure the file is in your current working directory? Often people simply put the full path such as "/Users/Name/RBS.csv" Cheers, On Fri, Apr 19, 2013 at 9:30 AM, Gafar Matanmi Oyeyemi wrote: > I am trying to read a csv file using the code; > contol <- read.csv("RBS.csv") > This is the e

Re: [R] Reading CSV file

2013-04-19 Thread Steve Friedman
Make sure you have the correct path to the file. On Apr 19, 2013 10:53 AM, "Gafar Matanmi Oyeyemi" wrote: > I am trying to read a csv file using the code; > contol <- read.csv("RBS.csv") > This is the error message I got; > Error in file(file, "r") : unable to open connection > In addition: Warni

[R] Reading CSV file

2013-04-19 Thread Gafar Matanmi Oyeyemi
I am trying to read a csv file using the code; contol <- read.csv("RBS.csv") This is the error message I got; Error in file(file, "r") : unable to open connection In addition: Warning message: In file(file, "r") : cannot open file 'RBS.csv', reason 'No such file or directory' Where was the mistak

Re: [R] reading csv file : blanks

2009-04-29 Thread Dimitri Liakhovitski
When you read in a .csv file with some empty cells using read.csv, there is no need to specify anything - empty cells will be recorded as NAs automatically: try: data1<-read.csv("oa_2006.csv") Dimitri On Wed, Apr 29, 2009 at 7:54 AM, Jim Lemon wrote: > Nattu wrote: >> >> Hi, >> >> I have a co

Re: [R] reading csv file : blanks

2009-04-29 Thread Jim Lemon
Nattu wrote: Hi, I have a comma seperated data file which has blanks in it. I am trinying to import it to R using data1<-read.csv("oa_2006.csv", header = TRUE, sep = ",", quote="\"", dec=".") I want the missing values to be "NA". instead R reads them as "U". Any idea why this happens ? Hi

[R] reading csv file : blanks

2009-04-29 Thread Nattu
Hi, I have a comma seperated data file which has blanks in it. I am trinying to import it to R using data1<-read.csv("oa_2006.csv", header = TRUE, sep = ",", quote="\"", dec=".") I want the missing values to be "NA". instead R reads them as "U". Any idea why this happens ? Thanks in advance. R

Re: [R] Reading CSV file with unequal record length

2008-07-02 Thread Marc Schwartz
on 07/02/2008 01:55 PM Viswanathan Shankar wrote: Hello , I am having some difficulty reading a CSV file of unequal record length in R . The data has 26 columns and do not have header and is generated from a R syntax - write.table(schat,"schat.csv", sep=",", col.names=FALSE, append = TRUE)

Re: [R] Reading CSV file with unequal record length

2008-07-02 Thread Peter Dalgaard
Viswanathan Shankar wrote: Hello , I am having some difficulty reading a CSV file of unequal record length in R . The data has 26 columns and do not have header and is generated from a R syntax - write.table(schat,"schat.csv", sep=",", col.names=FALSE, append = TRUE) 1.0,1.0,0.0,0.1,0.1,0.1

[R] Reading CSV file with unequal record length

2008-07-02 Thread Viswanathan Shankar
Hello , I am having some difficulty reading a CSV file of unequal record length in R . The data has 26 columns and do not have header and is generated from a R syntax - write.table(schat,"schat.csv", sep=",", col.names=FALSE, append = TRUE) 1.0,1.0,0.0,0.1,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.5

Re: [R] Reading .csv file under linux

2008-01-23 Thread David Scott
Just as an update on encoding (which may or may not be of interest). I changed the read.csv command for three .csv files I was reading to specify the encoding to be encoding="CP1252" and all 3 files were read in without problems on linux. Last night I swapped the analysis back on to my windo

Re: [R] Reading .csv file under linux

2008-01-22 Thread Peter Dalgaard
David Scott wrote: > I am a total dunce when it comes to encodings though. How do you find the > encoding of a file? > You don't. Either you know it, or you are up the proverbial creek (or roof). The "8-bit ascii" encodings is one of the greater computer crimes of the last century precisely b

Re: [R] Reading .csv file under linux

2008-01-22 Thread Prof Brian Ripley
On Wed, 23 Jan 2008, David Scott wrote: > On Tue, 22 Jan 2008, Prof Brian Ripley wrote: > >> On Wed, 23 Jan 2008, David Scott wrote: >> >>> >>> I have encountered a problem with reading a .csv file on a linux box. I >>> can read the file on my windows machine (under XP) but on the linux box it >

Re: [R] Reading .csv file under linux

2008-01-22 Thread David Scott
On Tue, 22 Jan 2008, Prof Brian Ripley wrote: > On Wed, 23 Jan 2008, David Scott wrote: > >> >> I have encountered a problem with reading a .csv file on a linux box. I >> can read the file on my windows machine (under XP) but on the linux box it >> gives : >> >>> patients <- read.csv("../Patient

Re: [R] Reading .csv file under linux

2008-01-22 Thread Prof Brian Ripley
On Wed, 23 Jan 2008, David Scott wrote: > > I have encountered a problem with reading a .csv file on a linux box. I > can read the file on my windows machine (under XP) but on the linux box it > gives : > >> patients <- read.csv("../Patients.csv", header = FALSE, > + col.names

[R] Reading .csv file under linux

2008-01-22 Thread David Scott
I have encountered a problem with reading a .csv file on a linux box. I can read the file on my windows machine (under XP) but on the linux box it gives : > patients <- read.csv("../Patients.csv", header = FALSE, + col.names = patientsNames) Error in type.convert(data[[i]],