Displaying 20 results from an estimated 1000 matches similar to: "dput/dget when a data frame has 2 rows (PR#9627)"
2007 Oct 17
1
dget not restoring dput in R 2.6.0 (PR#10350)
Full_Name: David States
Version: 2.6.0
OS: Windows XP64
Submission from: (NULL) (141.211.38.9)
# The pair of commands
#
# dput(object, "file.dput")
# object = dget("file.dput")
#
# should be a no op, but this is not working correctly for all objects.
#
# Simple example:
#
# make a simple object of class "hclust"
cl = hclust(dist(matrix(nrow=4,ncol=4, c(1:16))))
#
2004 Jul 15
1
dput and dget
I am seeking advice about dput() and dget().
We are using the ascii format supported by these functions as a way to
write data from other programs that can be read into R easily. We are able
to save complicated results (in the form of an R list) to a single file
that can be read trivially into R or S-Plus.
My question is whether that format can be considered a safe one for
medium-term (say
2007 May 15
1
legend with mixed boxes and lines (not both)
Hi,
I seem to be unable to get a mixed legend that has lines *or* polygons
(not both). For example:
ppi <- seq(0,2*pi,length.out=21)[-21]
frame()
plot.window(ylim=c(-5,5),xlim=c(-5,5),asp=1)
polygon(cos(ppi)*4+rnorm(20,sd=.2),sin(ppi)*4+rnorm(20,sd=.2),
col="green",border=FALSE)
polygon(cos(ppi)*2+rnorm(20,sd=.1),sin(ppi)*2+rnorm(20,sd=.1),
col="blue",border=FALSE)
2009 Dec 08
1
problem with split eating giga-bytes of memory
I'm having trouble using split on a very large data-set with ~1400 levels of
the factor to be split. Unfortunately, I can't reproduce it with the simple
self-contained example below. As you can see, splitting the artificial
dataframe of size ~13MB results in a split dataframe of ~ 144MB, with an
increase memory allocation of ~10 fold for the split object. If split scales
linearly, then my
2011 Apr 07
3
Correlation Matrix
Listers,
I have a question regarding correlation matrices. It is fairly straight
forward to build a correlation matrix of an entire data frame. I simply use
the command cor(MyDataFrame). However, what I would like to do is construct
a smaller correlation matrix using just three of the variable out of my data
set.
When I run this:
cor(MyDataFrame$variable1,
2010 Mar 11
2
Can't convert list to matrix properly
Hi guys, here is a list of names that I have:
MyList:
> myList<-list("A", "B","C","D")
> myList
[[1]]
[1] "A"
[[2]]
[1] "B"
[[3]]
[1] "C"
[[4]]
[1] "D"
I want to turn this list into a matrix of 1 row and 4 columns with those
four components (A, B, C, D) so here is what I do:
myDataFrame <-
2007 Oct 24
3
Partial aggregate on sorted data
Hi All,
I'm looking for ways to compute aggregate statistics (with the aggregate
function) but with an option for sorting and selecting a subset of the data
frame. For example, I have would like to turn this :
aggregate(myDataframe$TargetValue,list(SomeFactor =
myDataframe$SomeFactor),mean)
into something like
aggregate(myDataframe$TargetValue,list(SomeFactor =
2012 Jul 04
2
Difference between two-way ANOVA and (two-way) ANCOVA
Hi!
as my subject says I am struggling with the different of a two-way ANOVA and
a (two-way) ANCOVA.
I found the following examples from this webpage:
http://www.statmethods.net/stats/anova.html
# One Way Anova (Completely Randomized Design)
fit <- aov(y ~ A, data=mydataframe)
# Randomized Block Design (B is the blocking factor)
fit <- aov(y ~ A + B, data=mydataframe)
# Two Way
2005 Apr 04
2
mysql retrive question
hello R-Users,
I have this simple but not for me question:
I do:
> res<-dbSendQuery(con, "SELECT * FROM tabellaProva")
> myDataFrame<-fetch(res)
> myDataMatrix<-as.matrix(myDataFrame[,-1])
> namerows(myDataMatrix)<-as.character(myDataFrame[,1])
and I have:
io tu
io "0" "1"
tu "1" "0"
my problem is that the
2010 Apr 29
2
understanding behavior of "merge"
I'm trying to bootstrap resample from a repeated measures dataset. I sample
a vector of "ID"'s from my dataframe with replacement.
Then I merge this back with my dataframe.
I'm re-sampling subjects in the dataset rather than rows of the data.
I thought I could use the left/right join features of the merge to select
the records I want from the dataframe (mydataframe), like
2010 May 15
1
Dataframe to word, using R2wd
Hi All,
I'm trying to use R2wd to send a dataframe to Word. The dataframe
isn't huge - 300 rows, 12 variables, although it has some long strings
in it.
Using:
wdTable(format(myDataFrame))
or
wdTable(myDataFrame)
Produces a very complex table, which Word struggles to process and
layout. (I can't work out what the table is - it seems to be nested
tables. Converting to text gives
2012 Jul 19
2
problem with using apply for dataframe
Dear people,
I am including an example of a dataframe:
mydataframe<-data.frame(X=c(1:4),total_bill=c(16.99,10.34,21.01,23.68),tip=c(1.01,1.66,3.50,3.31),sex=c("Male","Male","Male","Female"))
When I use the sapply function getting the information about the factors
works:
sapply(mydataframe,function(x)is.factor(x))
X total_bill tip
2010 Apr 26
1
Sweave: centering with echo=TRUE
In a .Rnw file I want to insert the R command
pairs(mydataframe)
and achieve the following effects
1. the command itseld is echoed into the tex document generated by Sweave
<<fig=TRUE,echo=TRUE>>=
2. The graphics generated appears in the tex document, with the graphics
centred.
3. The R command > pairs(mydataframe) is not centered.
Sweave-manual.pdf gives the following code chunk
2005 Jun 15
1
anova.lme error
Hi,
I am working with R version 2.1.0, and I seem to have run into what looks
like a bug. I get the same error message when I run R on Windows as well as
when I run it on Linux.
When I call anova to do a LR test from inside a function, I get an error.
The same call works outside of a function. It appears to not find the right
environment when called from inside a function. I have provided
2004 Nov 20
2
subset on data frame
I have a data frame. And I'd like to subset according to rownames.
subset(mydataframe, rownames(mydataframe) == myrow, select = mycols)
it turned out that "myrow" cannot be a vector. But I have multiple rows to
pick. Is there a way to get around this problem??
Thank you for your help!!
Lei Jiang
Department of Chemsitry
University of Washington
Box 351700
Seattle, WA 98195
2011 May 27
1
Reference Classes/S4 Classes: can method dispatch check superclasses BEFORE resorting to method for "ANY"?
Dear list,
is it possible that method dispatch checks for superclasses/virtual
classes before checking "ANY"?
I'd like to build a generic initialization method for all my Reference
Class (say "MyDataFrame") objects by having them inherit from class, say
"MyRefClassVirtual" (which would have to be a virtual S4 class; there
are no virtual Reference Classes,
2005 Aug 15
1
png and resolution (PR#8066)
Full_Name: Knut krueger
Version: 2.1.1
OS: xp Home
Submission from: (NULL) (149.225.134.34)
In the png function the value res seems to be inactive:
bmp(filename = "c:/r/Rplot%03d.bmp", width = 1920, height = 1920, pointsize =
48, bg = "white", res = 2400)
result:
witdh/heigth = 1920 <> 20.32 mm
ppi=2400
Results as expected
png(filename =
2011 Dec 22
1
ff object in lapply function
Hello. I'm using as.ffdf(mydataframe) to create ffdf objects inside an lapply
loop and returning that. I then use crbind to combine the lapply results
into allData.
So...simplified flow looks like this.
res <- lapply(1:nchunks, function(n)
{
blah blah with nth chunk
mydataframe <- data.frame(blah blah)
dat <-
2014 Jun 20
1
dget() much slower in recent R versions
Hello,
I've noticed that dget() is much slower in the current and devel R
versions than in previous versions. In 2.15 reading a 10000-row
data.frame takes less than half a second:
> (which.r <- R.Version()$version.string)
[1] "R version 2.15.2 (2012-10-26)"
> x <- data.frame(matrix(sample(letters, 100000, replace = TRUE), ncol = 10))
> dput(x, which.r)
>
2018 Mar 12
0
Equivalent of gtools::mixedsort in R base
1- mixedorder does not work in a "do.call(mixedorder, mydataframe)"
call like the order function does
This is tangential, but do.call(order, mydataframe) is not safe to use in a
general purpose function either - you need to remove the names from
the second argument:
> d <- data.frame(method=c("New","New","Old","Old","Old"),