Displaying 20 results from an estimated 50000 matches similar to: "how to handle no lines in input with pipe()"
2011 Aug 15
3
write.table extra column
In the following data.frame there are 6 columns, but 7 are written to
the CSV file.
install.packages("pmlr")
library(pmlr)
data(enzymes)
write.table(enzymes, sep=",", eol="\n",file="albert.csv")
2012 May 27
3
write.csv permissions
Dear R help,
I have a doubt regarding the write.csv function.? When I save a file (write.csv(res1,"res1.csv")), it is saving with the read-only permission.? I tried to change the permission as a root user with chmod u+x.? Though, it says that "-rwxr--r--? 1 root root???? 164 2012-05-27 10:18 res1.csv", when I open the file it is still read-only.? Is there any way to save the
2012 Oct 01
2
Input and output of time series data - any function or packages that helps?
Hello,
I work with time series data. From time to time I run programs to
produce results that are in time series form (e.g., quarterly or monthly
data). After a few days I might need to access part of the results and to
run another program. Is there any function or package (like dataframe or
zoo?) that might help so that I don't need to copy the results manually to
a csv or xls file?
2012 Aug 15
3
Basic question -loading data
Hi all,
New user here - I include the following command in the prompt
read.csv("document.csv", header = TRUE )
and the output shows up.
But when I include the following command
summary(data)
I get the following message "Error in object[[i]] : object of type 'closure' is not subsettable"
Can someone please advise why R is not reading my data?
Thanks
2012 Jul 14
2
writing data into files whose names are in a vector
GuRus
How do I use the write function (or write.table or write.csv) to achieve
the following please?
age=c(32,37,39)
names=c("john","peter","jake")
I would like create in a directory 3 files each named as john.csv,peter.csv
and jake.csv and each file have data from the age vector. That is jon.csv
will contain 32, peter.csv will contain 37 and jake.csv will contain
2012 Sep 13
1
Error during matrix multiplication
Hi,
I have two matrix from two different .csv files.
#load .csv files
a <- as.matrix(read.table("Whirr_127.csv", header=T, sep=",", row.names=1))
b <- as.matrix(read.table("Files_Whirr_127.csv", header=T, sep=",",
row.names=1))
a
b
I managed to do transpose to 'b' without any error.
transpose_task <- t(b)
transpose_task
But, when I tried
2012 Oct 24
1
incomplete final line found by readTableHeader
Hello,
I am trying to read in an Excel file that I saved as a .csv so I can analyze
my assignment data! I am getting really frustrated because this is what I
keep getting:
Warning message:
In read.table("CityData.CSV", sep = "/", header = T) :
incomplete final line found by readTableHeader on 'CityData.CSV'
I have open the file and make sure click return after
2013 Oct 27
2
numeric data being interpreted as a factor -trouble with reading data into a dataframe in R
Hello.
trying to do one of the simplest actions -read in data into R.
I don't know why the FBfollowers column is being read as a factor and also
if I use as.numeric on it, it looks really strange and actually complety
alters the data.
I am attaching the data set here called ddd.csv
I used
data=read.csv("ddd.csv",header=TRUE)
fb=data$FBfollowers
fb
fb=as.numeric(fb)
fb
Thnxs in
2011 Oct 10
1
Converting factor into date
Dear R users,
I have an elementary query.
I have a dataset which is taken from text file with the help of read.csv
command but when I generate the data in R file it converts the Dates into
factor.So for the above problem, I use as.Date to convert the Dates from
factor form to date format using the following: z has Date as a column.
*z<- read.csv("data", header = TRUE, sep =
2011 Sep 27
3
read.csv behaviour
This might be obvious but I was wondering if anyone knows quick and easy
way of writing out a CSV file with varying row lengths, ideally an
initial data read from a CSV file which has the same format. See example
below.
I found it quite strange that R cannot write it in one go, so one must
append blocks or post-process the file, is this true? (even Ruby can do
it!!)
Otherwise it puts
2011 Sep 27
3
read.csv behaviour
This might be obvious but I was wondering if anyone knows quick and easy
way of writing out a CSV file with varying row lengths, ideally an
initial data read from a CSV file which has the same format. See example
below.
I found it quite strange that R cannot write it in one go, so one must
append blocks or post-process the file, is this true? (even Ruby can do
it!!)
Otherwise it puts
2012 May 03
6
Cannot read or write to file in Linux Ubuntu
I am the proud owner of a new laptop since my old one died the other day.
Currently I have a dual-boot Windows 7 Home and Ubuntu 12.04 . I'll leave the Windows problems for another post.
I know practically nothing about Linux so I am probably doing something stupid but ... at the moment I cannot seem read or write files in Ubuntu. I am not having any problem saving other documents to the
2012 Jul 04
3
How to use Sys.time() while writing a csv file name
Dear R helpers,
I am using Beta distribution to generate the random no.s (recovery rates in my example). However, each time I need to save these random no.s in a csv format. To distinguish different csv files, one way I thought was use of Sys.time in the file name. My code is as follows -
# My code
rr = rbeta(25, 6.14, 8.12)
lgd = 1 - mean(rr)
write.csv(data.frame(recovery_rates = rr), file =
2013 Apr 25
2
[SQL]
Hi,
The data for my new project are in a bunch of .sql files, instead of the
clasic csv files that I'm used to work with.
Could someone explain to me how to read these files into R?
Thanks,
-Ignacio
[[alternative HTML version deleted]]
2017 Aug 18
1
help with stacked ggplot
Hi,
I am new to R and this is probably a very basic question but I can?t seem to figure out a solution. I am creating a stacked ggplot with the following data and code:
PercentageData.csv looks like this:
decision
treatment
percentage
labtreatment
defect
0
53.49
COMMON
defect
1
78.00
ASYMMETRIC
defect
2
96.67
PRIVATE
coop
0
46.51
COMMON
coop
1
22.00
ASYMMETRIC
coop
2
3.33
PRIVATE
%Load data:
2011 Feb 11
2
tzone and DST
I'm reading in ~3 years worth of data that includes hourly timestamps.
Presumably to avoid DST confusion, all the data is in PST time zone -- no
discontinuities in the spring or fall.
The data comes in a csv file, which I'm reading with
myvariable <- read.csv("my_data_file.csv",header=FALSE,
2012 Jul 07
4
replacement has length zero
I have been working on the following code but keep getting an err message. My
current thinking is that the problem is on the indexing but do not know how
to fix it. Any help please?
ungulate <- read.csv("Ungulate.csv",row.names=1)
ungulate <-
as.matrix(ungulate);colnames(ungulate)<-NULL;rownames(ungulate)<-NULL
habitat <- read.csv("Ungulate_vegetation.csv")
2013 Apr 20
2
Editing data sheet issue with write.table append
I'm running R 2.15.2 on Max OS X 10.6.8
If I write a simple file
Data1<-1
DF<-data.frame(Data1)
colnames(DF)<-"Col1"
and write to a csv file
write.table(DF,file="Data.csv",sep=",",row.names=FALSE,col.names=TRUE)
I can then append to it no problem
Data2<-2
Data3<-4
DF2<-data.frame(Data2)
DF3<-data.frame(Data3)
2012 Nov 02
1
mergeing a large number of large .csvs
Dear R help;
I'm currently trying to combine a large number (about 30 x 30) of large
.csvs together (each at least 10000 records). They are organized by plots,
hence 30 X 30, with each group of csvs in a folder which corresponds to the
plot. The unmerged csvs all have the same number of columns (5). The fifth
column has a different name for each csv. The number of rows is different.
The
2012 May 02
3
Numeric data not numeric in .csv file
I am a raw novice to R, playing around with a mini .csv dataset created in
Excel. I can read it in and the data looks OK in Excel and upon initial
inspection in R:
hikes <- read.csv("/Users/eproper/Desktop/hikes.csv", header=TRUE)
print(hikes)
does exactly what it is supposed to do.
Two of the variables are genuine strings, but the others ought to be
numeric, and R will calculate