Displaying 20 results from an estimated 30000 matches similar to: "Append to a csv file"
2009 Dec 17
3
write.csv and col.names=F
Hi All,
I always have a problem with write.csv when I want the column names to be
ignored, when I specify col.names=F, I get a header of V1 V2 V3 V4 etc.
for example I tried
write.csv(mydata, file="data.csv", quote=FALSE, row.names=F, col.names=F)
Warning message:
In write.csv(mydata, file = "data.csv", quote = FALSE, :
attempt to set 'col.names' ignored
>
2008 Feb 11
1
Help with write.csv
Dear all,
I am new to R. I am using the impute package with data contained in csv
file.
I have followed the example in the impute package as follows:
> mydata = read.csv("sample_impute.csv", header = TRUE)
> mydata.expr <- mydata[-1,-(1:2)]
> mydata.imputed <- impute.knn(as.matrix(mydata.expr))
The impute is succesful.
Then I try to write the imputation results
2009 Jan 07
3
breaking a loop in R
Hi All,
I was wondering if there is anything that breaks a loop in R. For example,
For (k in 1:100)
For ( i in 1:10){
If ( condition ){
Break the inner loop
}
}
}
In the above case, if the program runs the if statement, then I want the
inner loop for (i in 1:10) to stop looping and skip the rest of the program.
Thanks for your help
--
View this message in context:
2009 Feb 10
7
How to split a character vector into 3 vectors
Hi ,
Does any one know how to split a character vector , I have a vector X that
looks like this and each row has 3 characters
X
ASK
DGH
ASG
AUJ
FRT
I would like to split the vector into 3 vectors that look like this
X1 X2 X3
A S K
D G H
A S G
A U J
U R T
thanks
--
View this message in context: http://www.nabble.com/How-to-split-a-character-vector-into-3-vectors-tp21939492p21939492.html
2008 Jun 03
2
merge two data sets
I would like to merge ?data1 ?that contains 100 unique ID?s with another
data set ?data 2? with 150 ID?s and the age of those individuals ( the ID in
data1 is a subset of the ID in data 2) I would like to merge these data1
with data2 and have the result of the merge to have the ID ordered as in
data1.
Can this be done in R?
--
View this message in context:
2008 Aug 22
1
How to handle "~" character after csv importation
Dear R users,
I have to import some csv files in which column headers contain the
character "~". Following the following import call, the character seems
to be replaced by dots in the column names of my data frame. Plus, I
cannot query names(mydata) to find the column index which header should
contain "~" or "."
> mydata <-
2009 Feb 10
7
ifelse()
I have a problem with ifelse(), I do not understand how it works.
> X<-c(2,2,1,1,0,0)
> str(X)
num [1:6] 2 2 1 1 0 0
> Y<-ifelse(X>0,1,0)
> Y
[1] 1 1 1 1 0 0
>
Can some one explain what is going on, I do not understand what ifelse is
doing in this case. Can someone explain the output Y.
Thanks
--
View this message in context:
2010 Jun 24
1
read.csv does not find my file (windows xp)
I try to load a file
myData <- read.csv(file="C:\\myfolder\\mysubfolder\\mydata.csv",
head=TRUE, sep=";")
and get this error:
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'C:\myfolder\mysubfolder\mydata.csv: No such file
or directory
am I overlooking something?
I am
2010 Jul 15
2
write.csv() : attempt to set 'append' ignored... Why?
I'm running R 2.11.0 on a 32-bit Windows XP machine. Whenever I try to write
a csv file with 'append' set to TRUE, I get this message: attempt to set
'append' ignored.
Obviously, this is no good, since R is deleting my previously saved data
files, rather than appending to them. What can I do to fix this?
--
View this message in context:
2012 Jan 11
1
Constructing a data.frame from csv files
Dear R helpers,
Following is my R code where I am trying to calculate returns and then trying to create a data.frame. Since, I am not aware how many instruments I will be dealing so I have constructed a function. My R code is as follows -
library(plyr)
mydata <- data.frame(instru_name =
2010 Jun 01
2
New behavior of 'write.csv' append argument?
Dear R users,
I have recently begun to reuse some functions I made several months ago. The
scripts write to a .csv file using the 'write.csv' function with the append
option set to TRUE. This used to work fine, albeit with the warning
"appending column names to file". I upgraded to R version 2.11.0 on OSX
10.5.8 and 'write.csv' will no longer append any files - I get the
2011 Oct 06
1
Issue with read.csv treatment of numerics enclosed in quotes (and a confession)
Dear Help-Rs,
I've been dealing with this problem for some time, using a work-around to deal with it. It's time for me to come clean with my ineptitude and seek a what has got to be a more streamlined solution from the Help-Rverse.
I regularly import delimited text data that contains numerics enclosed in quotes (e.g., "00765288071"). Thing is, for some of these data, I need
2010 Aug 12
2
Append to csv without header
Hi,
I am writing a function that writes to a csv file for every call.
However, for the subsequent calls, I want to append the data to the existing
csv file without appending the column names again.
I tried searching in the previous posts, but I am stuck with different
errors.
Here is what I am doing (dataF is a data-frame):-
outputFilePath <- paste(getwd(), "/",
2010 Feb 26
6
using grep
Hi All,
I have a character vector with naems of cities in the us. I need to extract
the number that appear after the word "New York", for example,
x<-c("P Los Angeles44AZ", "P New York722AZ", "K New York20")
I want the results to be
722, 20
cab I use the grep function, if so how?
I appreciate your help, thanks,
--
View this message in context:
2012 Oct 10
1
write.csv with append = TRUE
Is there a way to make any of the write functions (.table or .csv) append
to the same file?
I get this warning message and do not know how to enable the appending.
Warning messages:
1: In write.csv(names(Lbys)[c], fo, append = TRUE) :
attempt to set 'append' ignored
2: In write.csv(Lbys[[c]], fo, append = TRUE) :
attempt to set 'append' ignored
Regards,
Alex van der Spek
2011 Jan 21
1
Reading gz compressed csv file - 'incomplete line found'
Hi all,
I am trying to download, decompress and read a csv file. My code:
myurl <-
"ftp://ftp.ncbi.nih.gov/pub/geo/DATA/supplementary/series/GSE24729/GSE24729_MitoNuclear_suppl_male_stats.csv.gz"
#
myfile <- "GSE24729_MitoNuclear_suppl_male_stats.csv.gz"
#
download.file(myurl, destfile=myfile, mode="w")
#
mycon <- gzcon(gzfile(myfile,
2010 Jan 19
3
problem with the precision of numbers
Hi All,
I was wodering if it is possible to increase the precision using R. I ran
the script below in R and MAPLE and I got different results when k is large.
Any idea how to fix this problem? thanks for your help
for (k in 0:2000){
s=0
for(i in 0:k){
s=s+((-1)^i)*3456*(1+i*1/2000)^3000
}
}
--
View this message in context:
2012 Sep 13
2
Remove serial number column in a Dataframe into CSV
Hi,
i have an small doubt.
How can we remove serial-number column while writing a dataframe in to a csv
file ?
for eg:-
write.csv(MyDataFrame,"c:/MyData.csv")
name place
----------- -----------
1 antony uk
2 john usa
3 arjun ind
here, in the csv file, serial number column is coming extra on the left-end
side.
i want to remove
2010 Jul 29
3
help splitting a data frame
Hi All,
I have a dataset that I would like to split based on : or ? ( the data file
is tab delimited) for example:
Ny:23-45 AC
BA:88-91 DB
KJ:21-13 PA
And I would like the data to be splitted and the final results look like
NY 23 45 AC
BA 88 91 DB
KJ 21 13 PA
I would like to have the resulting data as a data frame so each column is a
variable.
Thanks,
--
View this message in context:
2008 Aug 27
1
How to create additional columns?
I do have some data of dim 100*3 (i.e 100 rows and 3 columns ) stored in a
txt file. I want to read the data into R, Perform the same operation in
each row and store the result in a forth column( that I should create).
I do not know how I can create a forth column to store the result of the
operation for each row?
--
View this message in context: