Displaying 17 results from an estimated 17 matches for "csvfile".
2011 Aug 18
3
Speeding nested loops up
...RUE)
t <- Rainfall_dataset
print(t)
p<-cbind(t,y)
#y<-cbind(t,y)
#print(y)
}
# This where you write out array y to a csv file
# Save output as a csv file
site <- paste("site",i,"-",j)
csvfile <- paste(site,sep=".","csv"); print(csvfile)
path<- paste("c:/Data/",csvfile)
print(path)
write.csv(p,file=path, row.names = TRUE)
}
}
--
View this message in context: http://r.789695.n4.nabble.com/Speeding-nested-loops-up-tp3751485p375...
2007 Jul 08
1
Writing Excel (.xls) files on non-Windows OSs using Perl
...y have
similar requirements. Please note that I am providing this 'as is' and
don't have any plans to substantively modify or enhance the code. It
does what I need it to do. Feel free to modify for other needs as may be
required.
The basic calling schema is:
WriteXLS.pl [--CSVpath] [--CSVfiles] ExcelFileName
Where:
CSVpath = Path to the csv files created in R, typically done
using write.table()
CSVfiles = globbed file name specification (ie. *.csv)
ExcelFileName = FULL name of Excel .xls file to create
When the Excel file is created, a new worksheet (tab) will be created...
2007 Jun 21
2
segfault during cbind
...ocale:
LC_CTYPE=en_US;LC_NUMERIC=C;LC_TIME=en_US;LC_COLLATE=en_US;LC_MONETARY=en_US;LC_MESSAGES=en_US;LC_PAPER=en_US;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US;LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
> csvFile <- read.csv("Barley1.na22.annot.csv", as.is=TRUE, na.strings="---")
> probe <- csvFile[,1]
> gb <- csvFile[, 9]
> rm(csvFile)
> gb <- lapply(unlist(gb),
+ function(x) toupper(strsplit(x,"\\.")[[1]][1]))
> id_file <- cbind(prob...
2012 Jul 25
3
ff package: reading selected columns from csv
...----------------------------------------------------------
## *I want to read the second column only:*
x.class <- c('NULL', 'numeric','NULL','NULL','NULL', 'NULL', 'NULL')
##* The following command works fine:*
> read.csv.ffdf(file=csvfile, header=FALSE, skip=100,
> colClasses=x.class, nrows=1e3)
ffdf (all open) dim=c(1000,1), dimorder=c(1,2) row.names=NULL
ffdf virtual mapping
PhysicalName VirtualVmode PhysicalVmode AsIs VirtualIsMatrix
V2 V2 double double FALSE FALSE
PhysicalIsMatrix Physi...
2014 Jan 27
4
Perl Search::Xapian
...understanding of perl I guess is not the best it seems, any
help would be great, Thanks.
----------------snip---------------
#!/usr/bin/perl
use strict;
use warnings;
unless ($#ARGV eq 1) { die "Usage: <cvsfile> <dbpath>\n" };
use Search::Xapian;
use Tie::Handle::CSV;
my $csvfile = $ARGV[0];
my $dbpath = $ARGV[1];
my $db = Search::Xapian::WritableDatabase->new(
path => $dbpath,
mode => "DB_CREATE_OR_OPEN",
);
# setup TermGenerator that'll be used in indexing.
my $tg = Search::Xapian::TermGenerator->new();
$tg->set_stemmer(Se...
2012 Sep 14
1
Any way to get read.table.ffdf() (in the ff package) to pass colClasses or comment.char parameters through to read.fwf() ?
...this example (a slightly modified version of the documentation)
x <- data.frame(log=rep(c(FALSE, TRUE), length.out=26), int=1:26, dbl=1:26
+ 0.1, fac=factor(letters), ord=ordered(LETTERS), dct=Sys.time()+1:26,
dat=seq(as.Date("1910/1/1"), length.out=26, by=1))
x <- x[c(13:1, 13:1),]
csvfile <- tempPathFile(path=getOption("fftempdir"), extension="csv")
write.csv(x, file=csvfile, row.names=FALSE)
y <- read.csv(file=csvfile, header=TRUE, colClasses=c(dct="POSIXct",
dat="Date")) # "ordered" gives an error
ffx <- read.csv.ffdf(fil...
2006 Feb 06
4
Memory Issue while looping through CSV file
I have a site on a shared host at TextDrive. I have an import process
that imports a CSV file into the database using a ruby script executed
using script/runner. TextDrive has a memory limit which I am hitting
and the process gets killed. I get through to about 400 records before
it dies. I guess each time I instantate a new object for each record I
am using more memory but thought I was using
2010 Oct 21
3
importing csv gets me all 16,000 columns with "NA"
I'm new to R. I have a mac (OS10.6). I have converted an Excel file to a csv
to import into R. I have used many methods to import the file, most do not
work, the best so far is:
filename <- read.csv(/Users/Desktop/csvfile.csv", header=T, sep=","). I have
also tried taking out the header and sep lines and it still imports fine.
Regardless of what I do, it always brings in the data but also includes all
16,000+ columns from Excel with X.1 as the first column up to X.16345 (for
instance). Of course the...
2011 Aug 15
5
Labelling all variables at once (using Hmisc label)
I have a dataset and a list of labels. I simply want to apply the labels to the variables, all at once. The only way I was able to do it was using a loop:
for (i in 1:length(data)) label(data[,i]) <- data.labels[i]
I'd like to find the non-loop way to do it, using apply or the like... Any help appreciated.
[[alternative HTML version deleted]]
2012 Sep 17
1
How to filter information from a big .csv table into a new table
...value with f5 in t4.
Also, f10 has a same value with f10 in t2.
f1 f2 f3 f4 f5 f6 f7 f9 f10 f11
t1 1 0 1 0 1 0 0 0 0 1
t2 1 0 0 0 0 1 1 1 1 1
t4 1 0 0 0 1 0 0 0 0 0
New table (with row and column header) should be then saved in a new .
csvfile.
[[alternative HTML version deleted]]
2012 May 14
2
Error in names(x) <- value: 'names' attribute must be the same length as the vector
...urn:
`colnames<-`(`*tmp*`, value = c(""Item", "Color" ,"Number", "Size"))
I'm not exactly sure how to fix this problem. Any advice would be greatly
appreciated!
Thanks,
Priya
MODIFIED CODE:
# Looping through a series of CSV files
for (c in csvfiles)
{
#A DF (prevdf) was created based on an initial csv file..
#so the condition below states that if there are rows with NAs or the
number of rows in prevdf is zero
if( (apply(prevdf, 1, function(y) !sum(!is.na(y))==1) > 0) ||
(nrow(prevdf) == 0) )
{
#Open a new file
currentCSVFi...
2012 Sep 18
1
chunk row to new table/file
...1 in t4 is equal. However, t2
should not consider t1. Output should be like this:
f1 f2 f3 f4 f5 f6 f7 f9 f10 f11
t2 1 0 0 0 0 1 1 1 1 1
t4 1 0 0 0 1 0 0 0 0 0
New table(s) (with row and column header) should be then saved in a new .
csvfile.
Appreciate help from the expert!
[[alternative HTML version deleted]]
2013 Nov 29
0
Formatting output of plotKML
...0,550759988,Label D10,blue
433071,384763,205810120,Label D11,blue
433895,389174,859445905,Label D12,blue
443319,118260,662205408,Label D13,blue
459825,451261,465489204,Label D14,blue
459630,451405,807818766,Label D15,blue
Script:
# Load required libraries
library("plotKML")
# Read data
csvFile <- "test.csv"
map_data <- read.csv(csvFile, header=TRUE)
# Specify what are the x, y columns and create co-ordinate system
coordinates( map_data ) <- c("xCord","yCord")
proj4string( map_data ) <- CRS("+init=epsg:27700")
# Convert OS grid to lat/...
2006 Mar 16
6
File Auditing with rails - File I/O issue
Hey Folks,
I''ve written a script to generate a list of all files on a machine,
then zip the results. ?I''m going to stick a web front end on it, and use it to audit some file servers. The problem is that the ZIP compression/decompression isn''t working,
but its not what you might think. ?The script completes, but seems to
not actually write anything.
Here is a short
2006 Apr 20
0
MySQL support for LOAD DATA LOCAL
...v2.6) to Ruby 1.8.4 and RoR 1.1.2 (with mysql gem v2.7). Immediately
one of my scripts broke. It was using MySQL''s LOAD DATA LOCAL mechanism
to bulk load a CSV file. While it worked fine in the old version in the
new version when I do:
loadcmd = "load data local infile ''#{csvfile}'' ... "
ActiveRecord::Base.connection.excute(loadcmd)
it complains that MySQL doesn''t support that operation - sorry don''t
have the exact error message at the moment. I''ve logged into MySQL from
the console and successfully executed the loadcmd so I know...
2012 Sep 17
1
self defined distance matrix in NbClust
i m using a package NbClust for cluster analysis. in the following algorithm
->NbClust(m, diss="NULL", distance = "euclidean", min.nc=2, max.nc=15, method = "ward", index = "all", alphaBeale = 0.1)
i want to define my own dissimilarity matrix of dimension 38*38. my original data "m" is a matrix of 365*38. whenever i define my own dissimilarity
2010 Apr 14
3
PGError: duplicate key
...imestamps
end
csv_file = "#{Rails.root}/db/migrate/numbers.csv"
fields = ''(name, number)''
execute "COPY numbers from ''#{csv_file}'' DELIMITERS '','' CSV;"
end
def self.down
drop_table :numbers
end
end
CSVFILE:
1, "one", 1, Wed Apr 14 14:52:22 -0400 2010, Wed Apr 14 14:52:22 -0400
2010
2, "two", 2, Wed Apr 14 14:52:22 -0400 2010, Wed Apr 14 14:52:22 -0400
2010
3, "three", 3, Wed Apr 14 14:52:22 -0400 2010, Wed Apr 14 14:52:22
-0400 2010
4, "four", 4, Wed Apr 14 14:...