import-from-csv

FF in R: No Applicable Method for 'recodeLevels'

十年热恋 提交于 2019-12-25 02:34:23
问题 I'm trying to load a huge (~5GB) .csv file into R using read.csv.ffdf. The command goes: npi <- read.csv.ffdf(file="C:/Users/DSA/Dropbox/Team Shared Files/People/Ross/NPI_Parse/Zips/npi_full.csv", VERBOSE=TRUE, first.rows=10000,next.rows=100000,colClasses=NA) The command runs for a while and then throws the following error: "no applicable method for 'recodeLevels' applied to an object of class "c('double', 'numeric')." Some searching tells me I need to use the transFUN option but I have no

No rows to manipulate in html table created with jQuery csvToTable?

馋奶兔 提交于 2019-12-24 03:43:29
问题 I am a novice programmer and am hoping for some help with the following situation. I am able to read in a local external CSV file and display as an HTML table with jQuery csvToTable http://code.google.com/p/jquerycsvtotable/. I am also able to sort the table with the jQuery plugin tablesorter http://tablesorter.com/docs/. Now, I would like to improve the look and interactivity of the table, but I cannot seem to manipulate rows in the HTML table, for example, to do what should be simple things

R - read.table imports half of the dataset - no errors nor warnings

流过昼夜 提交于 2019-12-23 17:23:37
问题 I have a csv file with ~200 columns and ~170K rows. The data has been extensively groomed and I know that it is well-formed. When read.table completes, I see that approximately half of the rows have been imported. There are no warnings nor errors. I set options( warn = 2 ). I'm using 64-bit latest version and I increased the memory limit to 10gig. Scratching my head here...no idea how to proceed debugging this. Edit When I said half the file, I don't mean the first half. The last observation

Python Help: Creating a dict of {str:list of str} from csv file

烈酒焚心 提交于 2019-12-22 18:19:35
问题 I have to create a table in the format: {str: list of str} Opening a .csv file using the following code, I get: import csv cr = csv.reader(open("name.csv","r")) for row in cr: print(row) output: ['key1', 'key2', 'key3'] ['value1', 'value2', 'value3'] ['value4', 'value5', 'value6'] I essentially need to structure this into the format {'key1': ['value1', 'value4'], 'key2': ['value2', 'value5'], 'key3': ['value3', 'value6']} I'm stuck; I just can't think of a way to do this for it to work for

Loading data issues

时光总嘲笑我的痴心妄想 提交于 2019-12-20 06:38:17
问题 Datalink: Data Code: ccfsisims <- read.csv(file = "F:/Purdue University/RA_Position/PhD_ResearchandDissert/PhD_Draft/GTAP-CGE/GTAP_NewAggDatabase/NewFiles/GTAP_ConsIndex.csv", header=TRUE, sep=",", na.string="NA", dec=".", strip.white=TRUE) ccfsirsts <- as.data.frame(ccfsisims) ccfsirsts[7:25] <- sapply(ccfsirsts[7:25],as.numeric) ccfsirsts <- droplevels(ccfsirsts) ccfsirsts <- transform(ccfsirsts,sres=factor(sres,levels=unique(sres))) ccfsirsts[1:5,] Issue: So, if you check the column

Reading Tab Delimited Data in to R

拜拜、爱过 提交于 2019-12-18 18:52:11
问题 I am trying to read a large tab delimited file in to R. First I tried this: data <- read.table("data.csv", sep="\t") But it is reading some of the numeric variables in as factors So I tried to read in the data based on what type I want each variable to be like this: data <- read.table("data.csv", sep="\t", colClasses=c("character","numeric","numeric","character","boolean","numeric")) But when I try this it gives me an error: Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na

Import large csv file to mysql database using php

本秂侑毒 提交于 2019-12-18 12:33:15
问题 I have a very large CSV file (150 MB). What is the best way to import it to MySQL? I have to do some manipulation in PHP before inserting it into the MySQL table. 回答1: You could take a look at LOAD DATA INFILE in MySQL. You might be able to do the manipulations once the data is loaded into MySQL, rather than first reading it into PHP. First store the raw data in a temporary table using LOAD DATA INFILE, then transform the data to the target table using a statement like the following: INSERT

Exceeded maximum execution time during Import of CSV

浪尽此生 提交于 2019-12-13 07:57:56
问题 I followed Google's Interacting With Your Docs List tutorial on how to write a script on importing CSV files. After a lot of help I got it to work. However when I try to copy it, or modify it in any way, it times out with the error message: Exceeded maximum execution time. ...and doesn't run. Why would this be happening? This is the importFromCSV() function from the tutorial: function importFromCSV() { var fileName = Browser.inputBox("Enter the name of the file in your Docs List to import (e

How can I parse CSV data from a character vector to extract a data frame?

落花浮王杯 提交于 2019-12-12 08:19:49
问题 The read.table and read.csv functions in R are used to parse a file or URL containing delimited data and produce an R data frame. However, I already have a character vector that contains the CSV delimited data (using comma and \n as column and record delimiters), so I don't need to read it from a file or URL. How can I pass this character vector into read.table , read.csv , or scan() without writing it to a file on disk first and reading it back in? I realize that writing it to disk is

How to create a histogram based on true or false in R?

坚强是说给别人听的谎言 提交于 2019-12-12 03:29:26
问题 What I'm trying to do is create a two histograms in R , based on if an employee at SeaWorld negotiated a salary increase and one for if they did not negotiate a salary increase. Could someone please show me where I went wrong. Any help is appreciated. Here's an example of the textfile I'm using. emp received negotiated gender year #325 12.5 TRUE F 2013 #318 5.2 FALSE F 2013 #217 9.8 FALSE M 2013 #223 6.8 TRUE M 2013 #218 2.1 TRUE F 2006 #601 13.9 FALSE M 2006 #225 7.8 TRUE M 2006 #281 8.5