Displaying 20 results from an estimated 20000 matches similar to: "Unexpected behaviour as.data.frame"
2009 Jun 14
2
read.csv
If read.csv's colClasses= argument is NOT used then read.csv accepts
double quoted numerics:
1: > read.csv(stdin())
0: A,B
1: "1",1
2: "2",2
3:
A B
1 1 1
2 2 2
However, if colClasses is used then it seems that it does not:
> read.csv(stdin(), colClasses = "numeric")
0: A,B
1: "1",1
2: "2",2
3:
Error in scan(file, what, nmax, sep,
2007 Apr 12
2
How to manipulate the pointer of a file?
Dear friends.
With file( ) to obtain a pointer of a file, every time we use scan ( ) to
read one row of it, the pointer will point to the next row of the file. In
the following example, d1 and d2 are obtained the same way but they
correspond to different rows of the same file because the pointer of the
file moves down a row when a row of the file is read.
The following is an example:
a1
2023 Jun 13
1
log transform a data frame
Thank you so much David, here is correction:
d1=suppressWarnings(read.csv("/Users/anamaria/Downloads/B1.csv",
stringsAsFactors=FALSE, header=TRUE))
d1$X <- NULL
d2=as.matrix(sapply(d1, as.numeric))
pdf("~/graph.pdf")
b<-barplot(d2, legend= c("SYCL", "CUDA"), beside=
TRUE,las=2,cex.axis=0.7,cex.names=0.7,ylim=c(0,80), col=c("#9e9ac8",
2012 Jan 19
3
Not generating line chart
Hi All,
Can you please help me, why this code in not generating line chart?
library(ggplot2)
par(mfrow=c(1,3))
#qplot(TIME1, BASCHGA, data=Orange1, geom= c("point", "line"), colour= ACTTRT)
unique(Orange1$REFID) -> refid
for (i in refid)
{
Orange2 <- Orange1[i == Orange1$REFID, ]
pdf('PGA.pdf')
qplot(TIME1, BASCHGA, data=Orange2, geom= c("line"),
2011 Nov 29
1
Read TXT file with variable separation
Hi!
I have to import some TXT files into R, but the separation between the
columns are made with different blank spaces, but each file use the
same separation. Example:
31 104 5 0 11RUA SAO
SEBASTIAO 25
BAIRRO FILETO
01
2005 Aug 04
2
p-values
HI R-users,
I am trying to repeat an example from Rayner and Best "A contingency
table approach to nonparametric testing (Chapter 7, Ice cream example).
In their book they calculate Durbin's statistic, D1, a dispersion
statistics, D2, and a residual. P-values for each statistic is
calculated from a chi-square distribution and also Monte Carlo p-values.
I have found similar p-values
2015 May 13
3
Alternative for wildcard gnu extension in Makevars
Dirk Eddelbuettel <edd at debian.org> schreef:
> On 13 May 2015 at 17:27, Jan van der Laan wrote:
> |
> | I have some cpp-files from another library (boost) in a subdirectory
> | in my src directory (src/boost_src). I include these using the
> | following two lines in my Makevars:
> |
> | SOURCES = $(wildcard *.cpp boost_src/*.cpp)
> | OBJECTS = $(SOURCES:.cpp=.o)
2011 Apr 16
1
Matching Problem: Want to match to data.frame with inexact matching identifier (one identifier has to be in the range of the other).
Hello R-Community,
I have the following matching problem: I have two data.frames, one
with an observation every month (per company ID), and one with an
observation every quarter (per company ID; note that quarter means
fiscal quarter; therefore 1Q = Jan, Feb, Mar is not necessarily
correct and also, a fiscal quarter is not necessarily 3 month long).
For every month and company, I want to get the
2010 Dec 09
4
Sequence generation in a table
Dear R helpers
I have following input
f = c(257, 520, 110). I need to generate a decreasing sequence (decreasing by 100) which will give me an input (in a tabular form) like
257, 157, 57
520, 420, 320, 220, 120, 20
110, 10
I tried the following R code
f = c(257, 520, 110)
yy = matrix(data = NA, nrow = 3, ncol = 6)
for (i in 1:3)
{
value = NULL
for (j in 1 : 6)
{
2013 Mar 09
1
Unexpected behavior looping through sequence of dates
I understand that the two following loops should produce the exact same output. However, they do not. It appears that looping directly through the sequence of Date objects somehow makes them be coerced to numeric:
> date1 = "20130301"
> date2 = "20130302"
>
> d1 = as.Date(date1, format="%Y%m%d", tz="GMT")
> d2 = as.Date(date2,
2009 Jul 17
1
Calculating the trading days
Hi R,
I have two columns of date in a CSV file in the below format
29-Dec-06 25-Jan-07
29-Dec-06 25-Jan-07
29-Dec-06 25-Jan-07
2-Jan-07 25-Jan-07
2-Jan-07 25-Jan-07
2-Jan-07 25-Jan-07
I read in R using dat<-read.csv("Z:\\data.csv").
> class(dat[,1])
[1] "factor"
So I use
dat[,1]=as.Date(as.character(dat[,1]),"%d-%b-%YY")
> class(dat[,1])
[1]
2015 May 13
4
Alternative for wildcard gnu extension in Makevars
One other solution that's only a little crazy: you could have a R
function within your package that generates the appropriate (portable)
Makevars, and within the package `configure` script call that
function. For example"
R --vanilla --slave -e "source('R/makevars.R'); makevars()"
And that 'makevars()' function could generate portable
2024 Oct 10
2
Time zones in POSIClt objects
Thanks.
On 10/10/24 16:13, Jeff Newmiller wrote:
> POSIXt vectors do not support different time zones element-to-element.
> I complained about this on this list a couple of decades ago, and was
chastised for it. Evidently handling timezones per element was
considered to be too impractically slow to be a standard feature.
This is where it is unclear to me what the purpose is of the
2017 Oct 26
1
How to create a table structure in Java code?
Thanks! I just figured it out (thanks to "Beyond Compare") and was coming here to post back.
The boxM test doesn't work with that (now, finally working) REXP structure, but I probably now need to create a table or something and parse that structure.
So much fun! :)
Thanks again.
- M
Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted email.
> --------
2007 Dec 19
1
unexpected behavior from gzfile and unz
I get unexpected behavior from "readLines()" and
"scan()" depending on how the file is opened with
"gzfile" or "unz". More specifically:
> file <- gzfile("file.gz")
> readLines(file,1)
[1] "a\tb\tc"
> readLines(file,1)
[1] "a\tb\tc"
> close(file)
It seems that the stream is rewound between calls to
readLines.
2010 Sep 12
2
Efficient ways of merging data frames
Hi all,
I am just wondering if there is a more efficient way of merging two large
datasets based on the values of multiple columns, some of which are not
numerical.
The default merge function in dataframe is very inefficient and the merge
function in data.table seems to be faster, but it does not seem to allow
keys that are not numerical in nature.
Any other suggestion?
Thanks a lot!
2024 Oct 10
1
Time zones in POSIClt objects
Sys.setenv(TZ = "GMT") will set the local time zone to GMT so there
would only be one time
zone regardless of whether local or GMT were used.
On Thu, Oct 10, 2024 at 11:17?AM Jan van der Laan <rhelp at eoos.dds.nl> wrote:
>
> Thanks.
>
> On 10/10/24 16:13, Jeff Newmiller wrote:
> > POSIXt vectors do not support different time zones element-to-element.
>
>
2004 Oct 14
2
Samba ADS -- works with XP Pro, but not 2000 Pro
I am using Samba with Active Directory. I have successfully joined my
Samba server to the domain D1 ( net ads join -U username@D2.DOMAIN.COM
). I am able to succesfully connect from Windows XP clients ( with no
password ), but not from Windows 2000 ( even when specifying a password
). With w2k, I always get "Failed to verify incoming ticket!".
I think it has something to do with
2009 Feb 22
2
how to recover a list structure
I am experiencing some problems at working with lists at high level.
In the following "coef" contains the original DWT coefficients organized in a list.
Thorugh applying the following two commands:
coef.abs <- lapply(unlist(coef,recursive=FALSE,use.names =TRUE),abs)
coef.abs.sorted <- sort(unlist(coef.abs),decreasing=TRUE)
I get vector "coef.abs.sorted" containing
2009 Sep 10
2
R 2.9.2 memory max - object vector size
Me:
Win XP
4 gig ram
R 2.9.2
library(foreign) # to read/write SPSS files
library(doBy) # for summaryBy
library(RODBC)
setwd("C:\\Documents and Settings\\............00909BR")
gc()
memory.limit(size=4000)
## PROBLEM:
I have memory limit problems. R and otherwise. My dataframes for
merging or subsetting are about 300k to 900k records.
I've had errors such as vector size too large.