Displaying 20 results from an estimated 2000 matches similar to: "help please: put output into dataframe"
2010 Sep 04
4
Please explain "do.call" in this context, or critique to "stack this list faster"
I've been doing some consulting with students who seem to come to R
from SAS. They are usually pre-occupied with do loops and it is tough
to persuade them to trust R lists rather than keeping 100s of named
matrices floating around.
Often it happens that there is a list with lots of matrices or data
frames in it and we need to "stack those together". I thought it
would be a simple
2011 Aug 29
2
splitting into multiple dataframes and then create a loop to work
Dear All
Sorry for this simple question, I could not solve it by spending days.
My data looks like this:
# data
set.seed(1234)
clvar <- c( rep(1, 10), rep(2, 10), rep(3, 10), rep(4, 10)) # I have 100
level for this factor var;
yvar <- rnorm(40, 10,6);
var1 <- rnorm(40, 10,4); var2 <- rnorm(40, 10,4); var3 <- rnorm(40, 5, 2);
var4 <- rnorm(40, 10, 3); var5 <- rnorm(40, 15,
2004 Mar 24
2
debugging a code
Hello
just learned HowTo but R, reminded me with the way
Perl does it but with much less on-line commands, R
"AFAIK" has n, c, Q and where and cann't debug outside
the {}.
1) is there a more versatile/flexable debugging method
for R?
I have saved 2 functions in an ASCII file "digfun".
"getdata" function calls "squash" function and both
use loops. In
2018 Dec 30
3
[cfe-dev] Portable multiplication 64 x 64 -> 128 for int128 reimplementation
_mulx_u64 only exists when the target is x86_64. That's still not very
portable. I'm not opposed to removing the bmi2 check, but gcc also has the
same check so it doesn't improve portability much.
~Craig
On Sat, Dec 29, 2018 at 4:44 PM Arthur O'Dwyer via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> Hi Pawel,
>
> There is the _mulx_u64 intrinsic, but it
2006 Jun 26
1
Passing arguments from a function within another function
Hi all,
I have a function getSomeData() that is called from command line -
getSomeData(id='1240'). The function getSomeData() calls another function
getData that needs the exact same argument passed to getSomeData(). I am
using the function call getData(paste(names(args[1]), "=",
sQuote(args[[1]]))). The argument passed is- id='1240'.
The problem is that in
2006 Jun 29
1
Problems Creating an R package
Hi all,
When I check my package using "Rcmd check ..\myPackage\R.mykg" on Windows in
Command Prompt, this is what get:-
* using log directory 'C:/R/bin/R.getdata.Rcheck'
* using Version 2.3.1 (2006-06-01)
* checking for file 'R.getdata/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'R.getdata' version '1.0'
* checking
2003 Jan 30
2
Weird options(digits=n) behaviour
I noticed some very weird behaviour of the function: options(digits=n),
where n is the number of digits you would expect to get in R calculations.
Let's take a example:
> options(digits=4)
> getdata(caso.pool.k3.r3.e2)
[1] 6.053 2.641 -3.639 14.259 6.082
Which works fine... now, trying again, with different data:
> options(digits=4)
> getdata(controle.pool.k3.r3.e2)
2010 Sep 09
0
Fast / dependable way to "stack together" data frames from a list
Hi, everybody:
I asked about this in r-help last week and promised
a summary of answers. Special thanks to the folks
that helped me understand do.call and pointed me
toward plyr.
We face this problem all the time. A procedure
generates a list of data frames. How to stack them
together?
The short answer is that the plyr package's rbind.fill
method is probably the fastest method that is not
2004 Feb 28
1
when .Call can safely modify its arguments
Hi,
"Writing R Extensions Guide" clearly states that a C-function interfaced
via .Call() should not modify any of its arguments. However I wonder if
there are exceptions to this rule, i.e. when .Call can safely modify the
arguments. For example when a function creates a list that is then
populated by a call to a C function:
getData <- function() {
data <- list(a=double(2),
2012 Mar 28
2
Making Knitr work
Might not be the best place to ask, but i could get lucky..
I have setup an eclipse environment to write sweave files lately and wanted to switch to knitr. I could get it to work on easy files, but my earlier written sweave file fails to be knit properly.
Here is the error message:
Quitting from lines 273-276: Error in setwd(base.dir) : kann Arbeitsverzeichnis nicht wechseln (it says: cannot
2012 Jan 27
1
Overimposing one map in ssplot onto another
Hello!
I have 2 maps - both created in ssplot and both identical in terms of
outline. Is there any way to superimpose Map1 (which has black borders
between Canadian provinces) onto Map2 (which is also a map of Canada)?
Thanks a lot for your hints!
Dimitri
### A. Reading in Canada data at the province and then at the county level:
library(raster)
getData('ISO3') # Canada's code is
2012 Nov 06
1
how Can make function for selecting the products
HI.
I make this code:
getdata<-function('a','b','c' ,'d','e','f'){
drv <- dbDriver("SQLite")
con<-dbConnect(drv, "sqlite.db")
lt<-dbListTables(con)
myf<-data.frame(NULL)
for (i in 1:length(lt))
{
myfile<-dbReadTable(con,lt[i])
myfile1<-myfile[-c(14:44)]
myfile1$MODEL<-gsub(" ",
2007 Jun 14
2
connecting to DB2 database
Hi,
i am trying to connect to a DB2 server using the DBI library.
getData <- function()
{
driver <- dbDriver("DB2")
conn <- dbConnect(driver,"server","uname","pword")
data <- dbSendquery(conn, "select etc.")
}
When I run the function, i get the error
> data <- getData()
Error in
2017 Sep 21
1
Improve ScopedPrinter::printNumber? (was: [llvm] r313816 - [llvm-readobj] Fix 'Teach readobj to dump .res files'.)
Seeing the below commit, I wondered whether that's a genuine fix or
rather a workaround for a shortcoming in llvm::ScopedPrinter::printNumber.
The latter has overloads for [u]int{8,16,32,64}_t, presumably so that it
can take arguments of arbitrary integer types. However, at least on
recent macOS uint64_t is 'unsigned long long' (and uint32_t is 'unsigned
int') while
2006 Nov 17
1
Manipulating R lists in C
Hi,
I have been studying the R manual on lists but cannot seem to create a
simple R list in C - I keep on getting "'dimnames' applied to non-array"
whenever I attempt to assign names to the list elements:
Wanted output a list structure something like
[ type="Bid", price=2.0, volume=1000 ]
I can get up to a list of
[ "Bid2, 2.0, 1000 ]
But for the life of
2008 Nov 30
2
Snow and multi-processing
Dear R gurus,
I have a very embarrassingly parallelizable job that I am trying to speed up with snow on our local cluster. Basically, I am doing ~50,000 t.test for a series of micro-array experiments, one gene at a time. Thus, I can easily spread the load across multiple processors and nodes.
So, I have a master list object that tells me what rows to pick up for each genes to do the t.test from
2011 Oct 24
4
Problem with svyvar in survey package
I am facing a problem with a function in survey package. The function svyvar
gives the estimated population variance from a given sampling scheme. I am
working with a data having more than four continuous variables. In order to
have have population total for all those cont. variables I have written in
the following format
svyvar(~var1+var2+var3+var4+var5+var6,data) ; var1,var2,...,var6 are 6
2004 Mar 27
1
building a list in loop
Hello
getdata <- function(p){
fname <- NULL; dl <- list()#build the sturcture
builddl <- function(q,s){
fname <<- c(fname,s) #where "s" is a string
dl <<- list( dl, dt2)
}
list(names = fname, data = dl)
}
data <- getdata("c:\somepath")
> data
$names
[1] "fname"
$data
$data[[1]] <--- since there is no [[1]] how can I
stop
2009 Oct 01
5
How to use Subpopulation data?
Dear Helpers
I have a sample frame and i have sampled from it using three methods and now i want to calculate the statistics but i only get the population parameters.
H <- matrix(rnorm(100, mean=50000, sd=5000))
sampleframe=data.frame(type=c(rep("H",100)),value=c(H))
sampleframe
str=strata(sampleframe,c("type"),size=c(20,), method="srswor")
2012 Jan 25
4
x11() graphic device, displaying raster
Hello,
I am wondering about the X11() graphic device on Windows.
I try to plot a raster image but nothing gets displayed. I
found some pages where it is mentioned that x11() not
always supports raster rendering.
Is there any add on for x11, any update or any R-package
which solves that displaying problem in Windows?
What I try to test it is an example from the
package {raster}:
library(raster)