Displaying 20 results from an estimated 10000 matches similar to: "scalar assignment within a vector within function"
2012 Mar 30
1
avoiding expression evaluation when calling a function
Another question on functions - I have something that looks like
plotter<-function(i){
temp.i<-rwb[rwb$vector1 <=(i*.10),]
with(temp.i, plot(vector2, vector3, main=(i*.10),))
mod<-lm(vector3~vector3-1,data=temp.i)
r2<-summary(mod)$adj.r.squared
rsqrd[i]<-r2
legend("bottomright", legend=signif(r2), col="black")
abline(mod)
rsqrd<<-rsqrd
}
I'd
2012 Apr 01
1
indexing in a function doesn't work?
Hello,
I've written a small function that's supposed to save me some time, and
it's ending up killing it- the intention is to iteratively subset a dataset
fram on framevec, fit a model (either lm or nls depending on type) and
return the r2 or AIC from the model, respectively. Although as far as I can
tell in my code the plots are dependent on the fit of the model to the data
and the
2013 Jan 09
2
writing to .xlsx
Dear r helpers;
I'm interested in reading from and writing to large .xlsx files fairly
regularly. (Why, the naysayers may ask - and the answer is basically
colleagues and clients who prefer that format). I've tried out the
XLConnect and xlsx libraries, but the java implementation they use just
takes too much RAM for the files I'm working with.
gdata leverages perl and works really
2012 Oct 08
3
turn list into dataframe
Dear R users,
I'm starting to use 'apply' functions rather than for loops in R, and
sometimes the output is a bit different than what I want. In this case, the
command was
tapply(myvector,myindex,cumsum)
And the output was something like this:
$`SNRL1 Core 120`
[1] 2.8546 4.0778 5.2983 6.3863 7.5141 8.5498 9.5839 10.6933
$`SNRL1 Core 230`
[1] 7.6810 8.7648 9.8382
2011 Jul 30
2
iterative using values from a data frame to parameterize a function
Hello,
I'm just trying to wrap my head around the syntax for creating loops,
functions in R. I have an array of values from a .csv. Looks something like
header<-c(species,coefficient1, exponent1, coefficient2, exponent2,
constant)
with a species name for the first column, and values for coefficient1,
exponent1, coefficient2, exponent2, constant for each species.
The values are
2011 Apr 13
1
print to .jpeg
Evening folks,
I'm trying to print a series of graphs to .jpeg using a variable as the
title, but run into the difficultly that I can't find a way to append the
file extension to the .jpeg (in this case extensionless!) files.
Example:
----
species.name="CussoniaHolstii"
dia<-10:100
biomass = -21.4863 + 0.5797 * (dia ^ 2)
biomass
jpeg(species.name)
plot (biomass,
2012 Feb 02
1
gsub syntax help
I have some elements in a vector with extraneous information (e.g. file
name and sample IDs) that I'd like to strip from every element.
For example, I would like "SPI1.S1.str1.P3.sample.tif"
"SPI1.S1.STR2.P1.sample.tif" to read "SPI1.S1.str1.P3" "SPI1.S1.STR2.P1".
Will someone help me with the syntax in gsub? It needs to be something
like
2012 Jun 01
1
trouble with append() in a for loop
Hello all,
*
*
I'm having some difficulty, and I think the problem is with how I'm using
append() nested inside a for loop. The data are:
y,x
237537.61,873
5007.148438,227
17705.77306,400
12396.64369,427
228703.4021,1173
350181.9752,1538
59967.79376,630
140322.7774,710
42650.07251,630
5382.858702,264
34405.82429,637
92261.34614,980
144927.1713,1094
362998.7355,1420
203313.6442,1070
2013 Apr 20
2
matrix of size 30^5
Dear R helpers
Reproducible example:
#warning - this causes a hard freeze on the machines I've tried it on
matrix.holder<- matrix(rnorm(150), nrow=30, ncol=5)
Out=
expand.grid(matrix.holder[,1],matrix.holder[,2],matrix.holder[,3],matrix.holder[,4],
matrix.holder[,5])
Problem:
I'm running an analysis that I would like to do using a matrix containing
all the possible combinations of
2012 Nov 02
1
mergeing a large number of large .csvs
Dear R help;
I'm currently trying to combine a large number (about 30 x 30) of large
.csvs together (each at least 10000 records). They are organized by plots,
hence 30 X 30, with each group of csvs in a folder which corresponds to the
plot. The unmerged csvs all have the same number of columns (5). The fifth
column has a different name for each csv. The number of rows is different.
The
2011 May 13
1
using glmer to fit a mixed-effects model with gamma-distributed response variable
Sub: using glmer to fit a mixed-effects model with gamma-distributed
response variable
Hello,
I'm currently trying to fit a mixed effects model , i.e.:
> burnedmodel1.2<-glmer(gpost.f.crwn.length~lg.shigo.av+dbh+leaf.area+
bark.thick.bh+ht.any+ht.alive+(1|site/transect/plot), family=gaussian,
na.action=na.omit, data=rws30.BL)
If I run this code, I get the error below:
Error:
2011 Jul 21
1
simulation for equation with two variables
Hi,
I'm trying to run a basic simulation and sensitivity test by running an
equation with two variables and then plotting the results against each of
the vectors. R is running the vectors like this : 0 with 0, 1 with 1, etc. I
would like it to run them like 0 for 1:100, 1 for 1:100, and then the
reverse (so 100^2*100@ iterations. How do I get it to do that? Here's what I
have so far:
2011 Feb 10
2
for loop to merge .csvs
So I needed to merge 17 .csv files, and did so by brute force, but I might
need to do so again. Anyone have suggestions for a for loop that might do
the below for me (where a:r are separate .csv files)
ab<-merge(a,b,all=TRUE)
cd<-merge(c,d,all=TRUE)
ef<-merge(e,f,all=TRUE)
gh<-merge(g,h,all=TRUE)
ij<-merge(i,j,all=TRUE)
kl<-merge(k,l,all=TRUE)
no<-merge(m,n,all=TRUE)
2011 Jul 22
1
3d plotting with cloud and wireframe
Hi,
I'm trying to plot an equation in two variables to get a feel
for sensitivity to its parameters. I've run expand.grid to get made-up
vectors of the combinations of the two independent variables, and am trying
to plot the output of the dependent, M, against both the dependent in a 3d
space.
t <- 0:100
DBH <- 10:100
TxDBH<-expand.grid(t,DBH)
time<-TxDBH[,1]
2017 Nov 18
0
tcltk problems
Rolf,
looking at the configure script I believe you need to specify
--with-tcl-config=/usr/lib/tcl8.6/tclConfig.sh
and similarly
--with-tk-config=<location of tkConfig.sh>
HTH,
Peter
On Fri, Nov 17, 2017 at 8:43 PM, Rolf Turner <r.turner at auckland.ac.nz> wrote:
> On 18/11/17 17:00, Erin Hodgess wrote:
>>
>> When I have compiled from sourced on Ubuntu, I did NOT
2013 Feb 12
3
improving/speeding up a very large, slow simulation
Dear R help;
I'll preface this by saying that the example I've provided below is pretty
long, turgid, and otherwise a deep dive into a series of functions I wrote
for a simulation study. It is, however, reproducible and self-contained.
I'm trying to do my first simulation study that's quite big, and so I'll
say that the output of this simulation as I'd like it to be is
2017 Nov 18
3
tcltk problems
On 18/11/17 17:00, Erin Hodgess wrote:
> When I have compiled from sourced on Ubuntu, I did NOT include the
> "with-tcltk" and it worked fine.? Did you try that, please?
In the past I have configured without using the "--with-tcltk" flag,
and R of course built just fine. But it *did not* have tcltk
capability. When I wanted that capability I had to start using the
1999 Aug 22
4
Jet Direct Printers and Plotters
We have a HP Design Jet 650C Plotter which is hooked to the net via a
jetdirect nic. Now I dont have a clue on how to use this plotter over
the net. It doesent show up in the network neighborhood and I cant find
anything about jetdirect plotters in the Linux documentation or the
inet. The server is running Suse Linux 6.2 and Samba 2.05a.
TIA
Florian v. Behr
2012 Nov 27
3
Psych package: fa.diagram, how to re-arrange layout so numbers do not over-write each other
Dear R help
I have conducted a fa() analysis, and I want to use fa.diagram to assess the extent to which the 11 latent factors predict the 37 items in a psychological battery. However, the display on the screen has very large font size for the coefficients of the relationship between the 11 factors and the 37 items, so the numbers overlap and are therefore illegible. When I output this to a
2006 Feb 09
7
putting text in the corner
I want to write some text in a corner of my plot.
Is it possible to get the xlim and ylim of an open window?
Or is there anything similar like
legend(x="bottomright", inset=0.01,legend=...)
for
text(x=1,y=2, "test")
Thomas