Displaying 20 results from an estimated 10000 matches similar to: "using sqldf's read.csv.sql to read a file with "NA" for missing"
2008 Sep 05
1
casting help please
I have a data.frame which I believe is melted already and am having
trouble casting it to 'wide' format.
It looks something like
> (x <- data.frame(ticker=c(rep("A",5),rep("B",6)), date=c(1:5, 1:6),
value=c(NA,100*exp(rnorm(10,0,.1)))))
> cast(x, date ~ ticker) # this does what I want with toy data
But when I use my real data frame
>
2010 Mar 12
7
sqldf not joining all the fields
Dear R users,
I have two data frames that were read from text files as follows:
x_data <- read.table("x.txt", header = TRUE, sep = "|", quote = "\"'",
dec = ".",as.is = TRUE,na.strings = "NA",colClasses = NA,
nrows = 3864284,
skip = 0, check.names = TRUE,fill=TRUE,
strip.white = TRUE,
2009 Aug 03
3
Help with reshaping data.frame
I'm having trouble reshaping a data.frame from long to wide.
(I think that's the right terminology; feel free to educate me.)
I've looked at the reshape function and package and plyr package,
but I can't quite figure out how to do this after a dozen variations.
I have a data.frame with more levels than this, but similar to:
> tst
K1 K2 K3 V1 V2 V3
1 10 D a 0.08 99
2011 Mar 02
1
a question on sqldf's handling of missing value and factor
Dear subscribers:
I am using the following code to read a large number of big text files:
library(sqldf)
tempd <- file(XXXX)
tempdx <- sqldf("select * from tempd", dbname = tempfile(), file.format =
list(header = T, sep="\t", row.names = F))
The problem is: all my numberical variable become factor (maybe because
these columns all contain missing value). It would be
2009 Sep 18
1
what should names(x) be padded with when length(x) is increased?
R version 2.10.0 Under development (unstable) (2009-09-08 r49628)
Here are two somewhat related questions.
First, when we attach a too short names vector to a vector
the names vector is padded with NA's to the length of the
main vector: E.g.,
> x<-1:3
> names(x)<-c("One","Two")
> str(x)
Named int [1:3] 1 2 3
- attr(*, "names")=
2013 Apr 13
2
Comparison of Date format
Hi,
?In the example you provided, it looks like the dates in Date2 happens first.? So, I changed it a bit.?
DataA<- read.table(text="
ID,Status,Date1,Date2 ??? ??? ??????
1,A,3-Feb-01,15-May-01 ??? ???
1,B,15-May-01,16-May-01 ??? ???
1,A,16-May-01,3-Sep-01 ??? ??? ??? ??? ???
1,B,3-Sep-01,13-Sep-01 ??? ??? ??? ??? ???
1,C,13-Sep-01,26-Feb-04 ??? ??? ??? ??? ???
2012 Apr 30
1
Hmisc::pstamp, mfcol, and spacing
I am trying to make a nice 2x1 plot and add a timestamp with comment.
The pstamp function from Hmisc works nicely when mfcol=c(1,1),
but when mfcol=c(2,1), the stamp winds up in the wrong place:
> require('Hmisc')
> opar <- par(mfcol=c(2,1))
> plot(1:10)
> title(main="MAIN Title")
> plot(1:20)
> title(main="Another Title")
> pstamp("normal
2018 Mar 10
1
error message from sqldf
Dear R users,
I got the following error message from running sqldf code in R. do you know how to fix it? I read the sqldf package instruction and did not find a solution.
Thank you,
Ding
chr10 <- sqldf("select * from manifest where CHR==10")
UCN3cpg <- sqldf("select * from chr10 where MAPINFO between 5405573 and 5407594),
overwrite = TRUE")
Error: Table chr10
2004 Sep 16
1
cor() fails with big dataframe
Hello,
I have a big dataframe with *NO* na's (9 columns, 293380 rows).
# doing
memory.limit(size = 1000000000)
cor(x)
#gives
Error in cor(x) : missing observations in cov/cor
In addition: Warning message:
NAs introduced by coercion
#I found the obvious workaround:
COR <- matrix(rep(0, 81),9,9)
for (i in 1:9) for (j in 1:9) {if (i>j) COR[i,j] <- cor (x[,i],x[,j])}
#which works fine,
2002 Aug 07
2
cluster-analysis and NA's
Hi,
exist a special cluster-analysis algorithms
which can work with NA's.
a further "problem" is that i want cluster
variables not cases to identify special variable-set's.
Is it a common way turn the data.frame and use
kmeans,because this works with NA's, or have anybody another
method for finding "variable-sets" , with exception of factor analysis.
thanks for
2012 Nov 15
4
using ifelse to remove NA's from specific columns of a data frame containing strings and numbers
Hi everyone,
I have a data frame one of whose columns is a character vector and the rest
are numeric, and in debugging a script, I noticed that an ifelse call seems
to be coercing the character column to a numeric column, and producing
unintended values as a result. Roughly, here's what I tried to do:
df: a data frame with, say, the first column as a character column and the
second and
2005 Aug 18
4
[PATCH] ACM: adding C-support for policy translation and labeling support for domains
This patch:
* adds a C-based security policy translation tool to Xen (secpol_xml2bin)
and removes the current Java
security policy translator (Java dependencies). The C-based tool
integrates into the Xen source tree build
and install (using gnome libxml2 for XML parsing). See install.txt.
* introduces security labels and related tools. Users can now use
semantic-rich label names to put
2007 Aug 01
1
New R package sqldf
sqldf is an R package for running SQL select
statements on one or more R data frames. It is
optimized for convenience making it useful
for ad hoc queries against R data frames.
Given an SQL select statement whose tables
are the names of R data frames it:
- sets up the database (by default it transparently
sets up an in memory SQLite database using RSQLite;
however, MySQL via RMySQL, can be
2007 Aug 01
1
New R package sqldf
sqldf is an R package for running SQL select
statements on one or more R data frames. It is
optimized for convenience making it useful
for ad hoc queries against R data frames.
Given an SQL select statement whose tables
are the names of R data frames it:
- sets up the database (by default it transparently
sets up an in memory SQLite database using RSQLite;
however, MySQL via RMySQL, can be
2012 May 02
5
uneven vector length issue with read.zoo?
I truncated and simplified my code and the read in data that I'm working with
to isolate the issue. Here is the read in data and R script respectively:
http://r.789695.n4.nabble.com/file/n4604287/test.csv test.csv
http://pastebin.com/rCdaDqPm
Here is the terminal/R shell output that I hope the above replicates on your
screen:
> source("elecLoad.r", echo = TRUE)
> #Load
2004 Jan 21
1
[g]sub behaviour with NA (PR#6451)
Full_Name: Jonathan Swinton
Version: 1.9.0
OS: Windows 2000
Submission from: (NULL) (193.132.159.34)
Attempting to substitute a NA causes an error in sub.
> sub(x=NA,pattern="x",replacement="y")
Error in sub(pattern, replacement, x, ignore.case, extended) :
invalid argument
> sub(x=NA,pattern=NA,replacement="y")
[1] NA
The help page for sub says only
2017 Aug 09
1
arithmetic with zero-column data.frames
So as often there is more to it than you first think.
Let's consider this an RFC (for experienced long time R users) :
>>>>> Martin Maechler <maechler at stat.math.ethz.ch>
>>>>> on Wed, 9 Aug 2017 10:45:56 +0200 writes:
>>>>> William Dunlap via R-devel <r-devel at r-project.org>
>>>>> on Tue, 8 Aug 2017 11:59:45
2006 Oct 03
2
[IMPORTANT BUGFIX][ACM][XM] FIX essential security check in block-attach / indentation problem introduced in change set changeset 11572
This patch fixes an indentation error in main.py. The effect of this bug
is that block-attach does not check labels if the ACM is active. This
bug slipped in with change set 11572_:_ ad22c711ccb7
<http://xenbits.xensource.com/xen-unstable.hg?cs=ad22c711ccb7>.
This patch is essential and should get into 3.0.3. I tested the patch
with security off and on.
Thanks
Reiner
P.S. We are
2005 Nov 16
1
COM dates (was origin and "origin<-" in chron)
I was just looking for an easy way to convert between COM datetime and
chron datetime (both ways.)
I found examples on the list, but they involved origin.
Does anyone have functions for converting COM datetime <-> chron
datetimethat work "safely"?
David L. Reiner
> -----Original Message-----
> From: Gabor Grothendieck [mailto:ggrothendieck@gmail.com]
>
2006 Sep 04
2
Question about ACMError
Hi all,
Could you teach me about the behavior of xm commands when
''ACMError'' occurred?
I am testing the behavior of xm commands with wrong arguments.
When I tested xm commands related to security (xm *label/*policy),
I found that some of them.
- return 0,
- show ACMError''s Traceback messages.
Are these results specifications or bugs?
Example:
# xm cfgbootpolicy