Displaying 20 results from an estimated 10000 matches similar to: "How to import data as numeric array?"
2007 Jan 09
4
A question about R environment
Hi all,
I created environment "mytoolbox" by : mytoolbox <- new.env(parent=baseenv())
Is there anyway I put it in the search path ?
If you need some background :
In a project, I often write some small functions, and load them into my workspace directly, so when I list the objects
with ls(), it looks pretty messy. So I am wondering if it is possible to creat an
2006 Sep 27
2
How to pass expression as an argument
Hi,
I am writing a function and need to pass a function expression as an argument, for instance,
myfun <- function( express) {
x<- c(1,2,3)
y<-express
}
if I call the above function by myfun( x*2 ), I get 2 as the result, instead of 2,4,6 , could someone help me to
fix this problem ?
Furthermore, is that
2007 Feb 02
2
A question about dput
Hi,
I am trying to output a R data set for use in WinBugs, I used
dput(list(x=rnorm(100),N=100),file="bug.dat")
But I can't get the intended format: list(x=c(.......),N=100), instead, I got
something like this (copied the first two lines):
[00000000]???73?74?72?75??63?74?75?72??65?28?6C?69??73?74?28?78???? structure(list(x
2007 Jan 14
1
Questions about paste and assign
Hi,
I would like to assign a value to a member b of the list a in position 3, by calling:
assign( target, 2.34, 3)
My question is what the "target" should be. I tried target <- paste("a", $, "b") and something else,
but haven't got the right answer yet.
BTW, if I attached a list named
2007 Apr 01
1
Keep R packages in the R installation
Hi,
I just got a quick question here, when I install a new version of R , is there an easy to keep the installed R packages ?
Thanks a lot for any help.
tong
2007 Apr 02
2
Compiling C codes in Windows
Hi All,
I have been struggling to figure out how to compile c codes for R use. I am using Win XP + Cygwin + R binaries.
After I followed all the instructions in " Building R for Windows" from Murdoch's website, I tried to Run something like :
R CMD SHLIB C:\R\test.c , but still didn't get any output.
My first question is, does this mean I already did
2007 Apr 02
2
Compiling C codes in Windows
Hi All,
I have been struggling to figure out how to compile c codes for R use. I am using Win XP + Cygwin + R binaries.
After I followed all the instructions in " Building R for Windows" from Murdoch's website, I tried to Run something like :
R CMD SHLIB C:\R\test.c , but still didn't get any output.
My first question is, does this mean I already did
2017 Jun 01
2
subletting an array according to dimnames
Hi all,
I have a three dimensional array with the corresponding dimension names.
I would like to subset the array according to the dimension names. For
example,
suppose I want to extract the values corresponding to A=20, B=10, C=0. I
know I
can do:
P2[dimnames(P2)$A==20, dimnames(P2)$B==10, dimnames(P2)$C==0]
But is there a better way for doing this? Thanks for your help!
Hanna
>
2003 Oct 31
4
Array Dimension Names
I would like to reference array dimensions by name in an apply and a summary
function. For example:
apply(x, "workers", sum)
Is there a better way to do this than creating a new attribute for the array
and then creating new methods for apply and summary? I don't want to name
the individual elements of each dimension (such as with dimnames) but rather
name the dimensions. Thanks
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 Mar 17
1
How to change the label in plot.ts ?
Hi you guys:
I have been wondering if there is any way to change the labeling in plot.ts( ), for example , if I plot two sequences,
i always got y labels as "series1", "series2", I tried to use ylab=c((expression(mu_1)),(expression(mu_2))), but it
doesn't work.
thanks in advance for any help
best.
2006 Oct 28
1
A quesiton on data manipulation
Hi,
I have a data set (data frame) describing some features of the students in a high school in the following format:
Stu ID Year feature 1 feature 2 .............
1001 1990
1001 1991
1001 1992
1002 1990
1002 1991
1002 1992
Some features of a few of these students are missing, I would like to
2007 Jan 04
1
need help with debug package
Hi all,
I met a problem while using the debug package, I have the following program:
mainfun<- function(){
beta<-1
result<-subfun(beta+x)
}
subfun<-function(expr){
y <- eval(expr, envir=list(x=c(1,2)),enclos = parent.frame())
return(y)
}
I have no problem using this program without calling the debug
2007 Dec 27
1
Efficiency of for-loop in R
Hi,
I just realized that in Matlab, as long as memory is pre-allocated, doing for-loop doesn't cost more time than doing things in vector form.
But it seems in R, it still cost a lot to do for-loop. Is there any improvement in R that I missed. Thanks a lot.
Merry Xmas Everyone !
2017 Jun 02
0
subletting an array according to dimnames
Have you tried P2["20", "10", "0"] ?
Jean
On Thu, Jun 1, 2017 at 3:10 PM, li li <hannah.hlx at gmail.com> wrote:
> Hi all,
> I have a three dimensional array with the corresponding dimension names.
> I would like to subset the array according to the dimension names. For
> example,
> suppose I want to extract the values corresponding to A=20,
2005 Feb 17
1
Subsetting using dimnames on S4 array-based class
Hello,
I did send this message to r-help and got no reply, no I am resubmitting
here in case this was a bit too specific for the other list.
Many thanks,
Iago
From:
Iago Mosqueira
<imosqueira@suk.azti.es>
To:
r-help@stat.math.ethz.ch
Subject:
Subsetting using dimnames on S4
array-based class
2009 Jul 25
1
Determine the dimension-names of an element in an array in R
Hi:
How can I extract the dimension-names of a pre-defined element in a
multidimensional array in R ?
A toy example is provided below:
I have a 4-dimensional array with each dimension having certain length. In
the below example, "mydatastructure" explains the structure of my data.
mydatastructure = array(0, dim=c(length(b),length(z),length(x),length(d)),
dimnames=list(b,z,x,d))
where,
2007 Dec 14
3
Array dimnames
Dear all,
Possibly a rudimentary question, however any help is greatly appreciated. I
am sorting a large matrix into an array of dim(p(i),q,3). I put each entry
into a corresponding matrix (1 of the 3) based on some criteria. I figure
this will assist me in condensing code as I can loop through the 3rd
dimension of the array instead of generating 3 separate matrices and using
the same block of
2012 Aug 08
1
dimnames in array
Hello,
I'm working with an array; I'm trying to make it so that an array of
dim(42,2,2) has names whose length corresponds to that of the array,
and am hoping someone with experience with this can see what I'm not
doing correctly:
data11 = array(0,c(41,2,2))
y = lsoda(x0,times,fhn$fn.ode,pars)#This is make.fhn() from colloc
infer package#
y = y[,2:3]
2017 Aug 08
2
arithmetic with zero-column data.frames
Should arithmetic operations work on zero-column data.frames (returning a
zero-column data.frame with the same number of rows as the data.frame
argument(s))? Currently we get:
> 1 + data.frame(row.names=c("A","B"))
Error in data.frame(value, row.names = rn, check.names = FALSE, check.rows
= FALSE) :
row names supplied are of the wrong length
>