Could you possibly consider reading An Introduction to R, especially the
first few pages of chapter 5, and also a bit about vectors from chapter 2,
and maybe eventually even some other parts...
You have x[i][j] where length(i)==1, so x[i] will be a single element.
Having [j] there makes no sense
On 10/12/07, Julia Kröpfl [EMAIL PROTECTED] wrote:
Is there a package in R that does Q-type factor analysis?
I know how to do principal component analysis, but haven't found any
application of Q-type factor analysis.
Q-mode factor analysis is not a separate type of factor analysis but (in
Hi,
It would be much better to save your list with dump or dput or save (then
you can read it, respectively, with source, dget, or load). Sink is not
useful for this, but if you really have to (i.e., if you for some reason
can't re-run the analyses and make these lists anew), you can do something
On Tue, Jun 30, 2009 at 2:36 PM, gug guygr...@netvigator.com wrote:
I've been using attach because I was following one of the approaches
recommended in this Basic Statistics and R tutorial
(http://ehsan.karim.googlepages.com/lab251t3.pdf), in order to be able to
easily use the column
On Wed, Jul 1, 2009 at 3:02 AM, gug guygr...@netvigator.com wrote:
sapply(ls(), function(x) object.size(get(x)))
-This lists all objects with the memory each is using (I should be honest
and say that, never having used sapply before, I don't truly understand
the syntax of this, but it
On Thu, Jul 2, 2009 at 4:34 AM, Rolf Turner r.tur...@auckland.ac.nz wrote:
On 2/07/2009, at 12:20 PM, Hsiu-Khuern Tang wrote:
Is this expected behavior?
z - 1:5
z[1] - 0
Error in z[1] - 0 : object z not found
The documentation seems to suggest that z will be found in the global
On Wed, Aug 5, 2009 at 11:28 PM, Erik Iverson eiver...@nmdp.org wrote:
First, this has nothing to do with 0. Assigning 1000 to an element of v
would also have this effect. Two, the first element of a vector is indexed
by 1, not 0. While what you wrote isn't a syntax error (v[0] - 0), it
Take a look at packages pixmap and rimage ... and read.picture() in package
SoPhy for reading tiff images.
Currently there seems to be no way of reading in png files directly, so they
need to be converted first.
Kenn
On Wed, Aug 6, 2008 at 11:47 AM, Tomas Lanczos [EMAIL PROTECTED] wrote:
one way would be:
mapply(tapply, iris[,1:4], MoreArgs=list(iris[,5], mean))
K
On Thu, Aug 7, 2008 at 2:01 PM, glaporta [EMAIL PROTECTED] wrote:
Hi folk,
I tried this and it works just perfectly
tapply(iris[,1],iris[5],mean)
but, how to obtain a single table from multiple variables?
In
There's more to this trend: SPSS and Statistica now advertise R language
support :
http://www.statsoft.com/industries/Rlanguage.htm
http://www.spss.com/spssdirections/na/sessions.cfm?sessionType=2
Kenn Konstabel
On Fri, Aug 8, 2008 at 5:30 PM, Marc Schwartz [EMAIL PROTECTED]wrote:
on 08/08
lt[!is.na(lt)] is a rather obvious way...
On Fri, Aug 22, 2008 at 9:41 PM, Dong-hyun Oh [EMAIL PROTECTED] wrote:
Dear useRs,
I would like to know the way of deleting NA in list().
Following is a example.
lt - list(a = 1:3, b = NA, c = letters[1:3], d = NA)
for(i in length(lt):1) {
this:
sapply(lt, function(x) all(is.na(x)))
Kenn
On Mon, Aug 25, 2008 at 3:33 AM, Kenn Konstabel [EMAIL PROTECTED]
wrote:
lt[!is.na(lt)] is a rather obvious way...
On Fri, Aug 22, 2008 at 9:41 PM, Dong-hyun Oh [EMAIL PROTECTED]
wrote:
Dear useRs,
I would like to know the way
or ...
sapply(m,function(x) table(factor(x, levels=c(NA, 1:4), exclude=NULL)))
On Fri, Sep 19, 2008 at 12:59 PM, Ralikwen [EMAIL PROTECTED] wrote:
Hi,
I went for a slight alteration of your solution
x1-c(1,2,3,4,NA ,NA ,NA, 3, 1, 1, 1, 1, 2, 2, 3, 4, 4)
Conversion to factor may happen (and often does) when you read in data with
read.table(). So one solution may be reading in the same data again in a
slightly different way:
read.table(file=mydatafile, as.is=TRUE)
# see also ?read.table
You can also specify a class to each column of the data
On Fri, Jun 20, 2008 at 2:47 AM, Anh Tran [EMAIL PROTECTED] wrote:
Thanks. I think I've got it. However, the density is plotted, not the
frequency. Is there a way to convert the density back to frequency.
Thanks a bunch.
an easy answer is that hist returns an object which you plot in any way
another way to do it is using eval and parse:
yyy-numeric()
for(i in 1:length(xxx)) yyy[i] - eval(parse(text=xxx[i]))
or ...
unlist(lapply(as.list(xxx), function(x) eval(parse(text=x
then xxx can contain any valid expressions (not necessarily fractions)
Kenn
On Sat, Jun 21, 2008 at 12:44
Can't you just import data from Excel using RODBC, then use your function in
R, and then write the results to Excel again? It would be much less painful
than doing it in VBA...
Otherwise, look for MMult and Transpose and similar things in VB help, and
then ask some VB experts...
Kenn
On Sat,
On Mon, Jun 23, 2008 at 9:12 PM, Gundala Viswanath [EMAIL PROTECTED]
wrote:
I've also tried with
data$var
But still fail to access var column
you can't use $ with matrices (see help($) !), but you can use [ with
names, or convert you matrix to a data frame:
myData[, var]
On Wed, Jun 25, 2008 at 6:00 PM, Victor Homar [EMAIL PROTECTED] wrote:
Hi, I'm trying to use sapply to compute the min of several variables,
each
of them stored in data.frames, grouped as a list:
Is it normal that mean() and min() produce different objects dimensions?
it is exactly
apply max to columns f1...f4 and assign it to rs$f:
rs$f - apply(rs[,paste(f,1:4,sep=)],1,max)
or
rs$f - apply(rs[,2:5],1,max)
On Wed, Jun 25, 2008 at 1:41 AM, Anh Tran [EMAIL PROTECTED] wrote:
Hi,
Here's the data we have:
rs[1:5,]
probe_id f1 f2 f3 f4 MA f
On Thu, Jun 26, 2008 at 12:14 AM, Wacek Kusnierczyk
[EMAIL PROTECTED] wrote:
sapply(dats,function(x){sapply(x,min)})
you can achieve the same with
sapply(dats, sapply, min)
Did you actually try it?
dats - data.frame(1:10,2:11)
sapply(dats,sapply,min)
X1.10 X2.11
[1,]
Sorry, my mistake, - it works both ways with a correct example and neither
way with the wrong example.
k
On Thu, Jun 26, 2008 at 4:25 PM, Wacek Kusnierczyk
[EMAIL PROTECTED] wrote:
sapply(dats,function(x){sapply(x,min)})
you can achieve the same with
sapply(dats, sapply, min)
use the function resid instead of lm.object$residuals to extract the
residuals:
resid(lm(a~b, na.action=na.exclude))
1 2 3 4
5 6
-2.533445e-17 4.222409e-17 -8.444818e-18 -8.444818e-18
NANA
lm(a~b,
another way:
split(1:184, rep(1:92, each=2))
On Tue, Jul 1, 2008 at 3:46 PM, Boks, M.P.M. [EMAIL PROTECTED]
wrote:
Dear experts,
For the makeGenotype function I need a list as in the example. However,
since my list needs to be 184 long there must be an easy way to make it.
for example ...
x - 1:5 ; y- 6:8
(m - x %o% y) # is this what you mean by product of two vectors?
sum(m[row(m)!=col(m)]) # or ...
sum(m)-sum(diag(m))
On Wed, Jul 2, 2008 at 7:30 PM, Murali Menon [EMAIL PROTECTED] wrote:
folks,
is there a clever way to compute the sum of the product of
On Tue, Jul 8, 2008 at 9:53 AM, Shubha Vishwanath Karanth
[EMAIL PROTECTED] wrote:
...actually I need to allocate certain amount of money (here I mentioned
it as 100) to a randomly selected stocks(50 stocks)... i.e., 100 being
divided among 50 stocks and preferably all are integer
try something like this:
x-c(220a1, 220ab1, 220a12, a34dkaffdse223, abc123)
sub(.*([[:digit:]]{3}).*, \\1, x)
( ?regexp is also useful)
kk
On Fri, Jul 11, 2008 at 12:04 PM, Kunzler, Andreas [EMAIL PROTECTED]
wrote:
Thank you a lot,
I am almost done, but unfortunately I have to manipulate
Returning to the old question ...
Is it possible to subset an n-dimensional array by a
vector of n dimensions?
On Sat, Jul 12, 2008 at 1:34 AM, Wolfgang Huber [EMAIL PROTECTED] wrote:
do.call([, list(x,1,2,TRUE))
[1] 3 9 15 21
See also
What you need is chapter 9 in
http://cran.r-project.org/doc/manuals/R-intro.pdf . And you could also use
chapter 2, especially 2.2.
specdist -matrix(NA,nrow=40,ncol=20)
for (j in 1:40){
for(i in 1:20){
On Sun, Apr 27, 2008 at 4:43 AM, Greg Snow [EMAIL PROTECTED] wrote:
What if mylist - list( 1:10, 101:110 , some.other.things) so the first 2
elements are vectors of length 10. then mylist[1:2] makes sense as still
being a list with the 2 vectors. What should mylist[[1:2]] return in this
Suppose X is a long vector of integers (typically about 3 elements). Is
there an efficient way to detect whether there are at least N consecutive
zeros in X, and if yes, where does this occur?
for example, suppose X is:
1 2 3 4 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 2 0 1 2 0 0 0 2 2 2 2 2 ...
I've used the following function (I wrote it some time ago so I don't
remember any more why I needed it, but I checked and it still works). I
don't think you can get rid of for loops altogether: if you look at the code
of apply, you'll see some there too.
The argument STATS specifies those
On Thu, May 15, 2008 at 3:05 PM, e-letter [EMAIL PROTECTED] wrote:
Using version 251 I tried the following command:
lm(y~a+b,data=datafile)
Resulting in, inter alia:
...
coefficients
(intercept) a
1.2 3.4
[...]
When using version 171 I entered the same command:
I'm not an expert at all, but isn't it that you really want svd(x)$u to be
different (instead of V)?
that would be easy to do:
x - matrix(rnorm(15), 3, 5)
s1 - svd(x)
s2 - svd(x, nv=ncol(x))
x1 - s1$u %*% diag(s1$d) %*% t(s1$v)
x2 - cbind(s2$u,1,1) %*% diag(c(s1$d,0,0)) %*% t(s2$v)
Can it be this:
foo-tapply(d$tt, d$v, min)
data.frame(v=names(foo), tt=foo)
On Sat, May 17, 2008 at 10:56 PM, jim holtman [EMAIL PROTECTED] wrote:
Is this what you want:
v-c(rep(v1,3), rep(v2,4), rep(v3,2),v4,rep(v5,6))
tt-c(1,2,3,3,1,2,3,4,5,2,7,9,2,3,1,4)
As it was already pointed out by others, you used different methods
(principal components in SAS vs. factor analysis in R). When you use the
same method (+ varimax rotation) in both programs, there may still be a
*small* difference: this comes from (possibly) different stopping criteria.
In R, the
You can interrupt the loop (e.g.. by pressing ESC), look at the results, and
then start it again.
e.g.
mumbo - list()
for(jumbo in 1:1e+5000) {
mumbo[[jumbo]] - do.many.time.consuming.things.with(jumbo)
}
# wait for a few days
# then press ESC
save(mumbo, file=head of mumbo)
# now
What ESC does is stopping current computation -- no idea how to do it in
ESS, but there's been a similar question in another list:
http://www.archivum.info/gnu.emacs.help/2005-10/msg00509.html
KK
On Mon, Apr 27, 2009 at 9:11 PM, Friedericksen golu...@gmx.de wrote:
Hey,
that is very cool!
if expects just one condition (no vectors); see ?ifelse
dataframe$thevector - ifelse(dataframe$factor==3, a.mean,
dataframe$thevector)
K
On Wed, Oct 1, 2008 at 12:05 PM, Whitt Kilburn [EMAIL PROTECTED] wrote:
Hello all,
I apologize for a terribly simple question. I'm used to using Stata
Hi,
To realize the data frame I've tried this
for (i in 1:1000)
{
foo-list(c(foo[],data.frame( Ce=DATA1.x[,i],Qe=DATA1.y[,i])))
}
I think the following would do it:
foo - list()
for(i in 1:1000) foo[[i]] - data.frame(Ce = DATA1.x[,i], Qe=DATA1.y[,i])
But then again, do you really
Hi,
I'm not quite sure I understood everything but is this something close?
d - read.table(textConnection(Dad_ID SpouseYN NKids NSick
1 10 1
2 02 2
3 10 2
4 13 3), header=TRUE)
mapply(sample,
On Tue, Nov 11, 2008 at 12:27 PM, Wacek Kusnierczyk
[EMAIL PROTECTED] wrote:
it's certainly hard to design and implement a system of the size of r.
it's certainly easier to just complain rather than make a better tool.
but it would really be a pitiful world if all of us were just
developing,
You can get a list of all functions in your workspace with
ls()[sapply(ls(), function(x) is.function(get(x)))]
# or ls()[sapply(sapply(ls(), get), is.function)]
Removing everything else is
rm(list=ls()[sapply(ls(), function(x) !is.function(get(x)))])
# or rm(list=ls()[!sapply(sapply(ls(),
For some clever reason, write.csv won't let you set col.names argument to
FALSE, but you can use it with write.table using sep=,.
A self-contained, minimal, and working example:
write.csv(matrix(1:10,2,5), test.csv)
write.table(matrix(11:20,2,5), test.csv, sep=,, append=TRUE,
col.names=FALSE)
lm does lots of computations, some of which you may never need. If speed
really matters, you might want to compute only those things you will really
use. If you only need coefficients, then using %*%, solve and crossprod will
be remarkably faster than lm
# repeating someone else's example
#
. Problem is that I suspect my colleagues who
are providing some guidance with the stats end are not quite experts
themselves, and certainly new to R.
Cheers,
Esmail
Kenn Konstabel wrote:
lm does lots of computations, some of which you may never need. If speed
really matters, you
is my print.function
only used if print is called explicitly. (Using R 2.7.0 on Windows.)
Kenn
Kenn Konstabel
Department of Chronic Diseases
National Institute for Health Development
Hiiu 42
Tallinn, Estonia
On Thu, Jul 17, 2008 at 6:55 PM, Peter Dalgaard [EMAIL PROTECTED]wrote:
Tudor Bodea wrote
Rounding can do no good because
round(8.8,1)-round(7.8,1)1
# still TRUE
round(8.8)-round(7.7)1
# FALSE
What you might do is compute a-b-1 and compare it to a very small number:
(8.8-7.8-1) 1e-10
# TRUE
K
On Wed, Dec 10, 2008 at 11:47 AM, emma jane [EMAIL PROTECTED] wrote:
Thanks Greg,
(7.8,1)1
[1] TRUE
round(8.8-7.8,1)1
[1] FALSE
round(8.8-7.8,1)==1
[1] TRUE
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil
-- Original Message ---
From: Kenn Konstabel [EMAIL PROTECTED]
To: emma jane [EMAIL PROTECTED]
Cc: R help [EMAIL
Hi,
On Tue, Dec 16, 2008 at 9:13 AM, Wacek Kusnierczyk
waclaw.marcin.kusnierc...@idi.ntnu.no wrote:
... but this is also legal if you really hate - :
foo({x = 2})
# assign to x, pass to foo as a
This is legal but doesn't do what you probably expect -- although
documentation for `-` says
suspected.
Best regards,
Kenn Konstabel
Department of Chronic Diseases
National Institute for Health Development
Hiiu 42
Tallinn
Estonia
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman
Which R version do you have? I'm asking this because my 2.7.0 gives a
different error message:
x[[q]]
Error in x[[q]] : recursive indexing failed at level 2
Anyway, as Wacek said, x[[q]] is equivalent to
x[[some]][[more]][[not_there]] -- and you don't have an element called
more in x[[some]].
It's done -- in any case -- just once, after the loop is finished. Remember
that hash sign is not just that, it's used for comments! Why should it be
surprising that your code will be doing something else when you comment out
(i.e. skip) some parts of it? Try this simplified example:
sample_times
All of it is an expression (see ?expression). Maybe you'd better explain
what exactly you're trying to do or what you mean by standard format and
usual way (this part depends very much on what you're used to). You can
manipulate parts of this expression, say, like this:
foo -
It would be helpful to give a MUCH shorter example. The problem you have
doesn't seem to be too complicated -- you don't need to explain all possible
details, just the ones that you think might cause the problem. (Saying it
doesn't work isn't helpful -- please be more specific and tell us what you
On Thu, Sep 3, 2009 at 5:50 AM, Peter Meilstrup
peter.meilst...@gmail.comwrote:
I'm trying to massage some data from Matlab into R. The matlab file has a
struct array which when imported into R using the R.matlab package,
becomes an R list with 3+ dimensions, the first of which corresponds to
The optimal way of doing it depends on how you want to use the result. An
easy way has been recommended - if you have
boo - list(first=data.frame(a=1:5, b=2:6), second=data.frame(a=6:10,
b=7:11))
.. then
sink(boo.txt)
boo # or: print(boo)
sink()
... will put it all in the same file, the same
You could (in addition to the other suggestions) try package proto (. refers
to self but see also the package's vignette)
account - proto(
deposit = function(., amount) {
if(amount = 0) stop(Deposits must be positive!\n)
.$total - .$total + amount
you can omit the list and do the following:
open.account.2 - function(total) {
deposit - function(amount) {
if(amount = 0)
stop(Deposits must be positive!\n)
total - total + amount
cat(amount, deposited. Your balance is, this$balance(),\n\n)
On Sun, Mar 20, 2011 at 4:13 AM, Kenn Konstabel lebats...@gmail.com wrote:
you can omit the list and do the following:
/.../
(but you don't really need this in this case as you can use balance
instead of this$balance)
P.S. using this would make some difference in one case:
instead
On Sun, Mar 20, 2011 at 12:43 PM, Duncan Murdoch
murdoch.dun...@gmail.comwrote:
On 11-03-19 10:21 PM, Kenn Konstabel wrote:
On Sun, Mar 20, 2011 at 4:13 AM, Kenn Konstabellebats...@gmail.com
wrote:
you can omit the list and do the following:
/.../
(but you don't really need
functions that one could be bothered to redefine this way - probably none.)
Thanks in advance for any ideas and comments (including the ones saying that
this is an awful idea)
Best regards,
Kenn
Kenn Konstabel
Department of Chronic Diseases
National Institute for Health Development
Hiiu 42
Tallinn
On Mon, Mar 21, 2011 at 2:53 PM, Gabor Grothendieck ggrothendi...@gmail.com
wrote:
On Mon, Mar 21, 2011 at 8:46 AM, Kenn Konstabel lebats...@gmail.com
wrote:
Dear all,
I sometimes use the following function:
Curry - function(FUN,...) {
# by Byron Ellis,
https://stat.ethz.ch
On Mon, Mar 21, 2011 at 5:57 PM, pat...@gmx.de wrote:
Hi list,
I have problems with the as.numeric function. I have imported probabilities
from external data, but they are classified as factors as str() shows.
Therefore my goal is to convert the colum from factor to numeric level with
On Tue, Mar 22, 2011 at 3:05 PM, Tonja Krueger tonja.krue...@web.de wrote:
Dear List,
I have a data frame with approximately 50 rows that looks like this:
Datetimevalue
19.07.1956 12:00:00 4.84
19.07.1956 13:00:00 4.85
I've used RODBC to read in ms access files... or if you're as lazy as
me you could use the following below (it can handle some other ms
office file types too and thinks it can recognize file types but as
has been pointed out in this list, using it with excel probably means
trouble)
read.mso -
On Wed, Mar 23, 2011 at 11:13 AM, Zablone Owiti zow...@ncst.go.ke wrote:
Dear users,
I wish to convert a column of data containing pentad (5day mean data)
from 1962 - 2000 into rows with each row having 73 values (ie. 73 pentads
per year).
1962 pent1 pent2 pent73
.
.
I tried this as an exercise and here's what I arrived to:
collector - function(expr){
RES - list()
foo - function(x) unlist(lapply(x, as.list))
EXPR - foo(expr)
while(length(EXPR) 0){
if(is.symbol(EXPR[[1]])){
RES - c(RES, EXPR[[1]])
EXPR - EXPR[-1]
On Thu, Mar 24, 2011 at 1:29 PM, Michael Bach pha...@gmail.com wrote:
Dear R users,
Given this data:
x - seq(1,100,1)
dx - as.POSIXct(x*900, origin=2007-06-01 00:00:00)
dfx - data.frame(dx)
Now to play around for example:
subset(dfx, dx as.POSIXct(2007-06-01 16:00:00))
Ok. Now for
Hi Knut,
On Fri, Mar 25, 2011 at 10:43 AM, Knut Krueger r...@knut-krueger.de wrote:
Hi to all,
how could I to rotate automatically a data sheet which was imported by
read.xls?
x1 x2 x3 xn
y1 1 4 7 ... xn/y1
y2 2 5 8 xn/y2
y3 3 6 9 xn/y2
yn ... ... ...
in the example above.
Best regards,
Kenn
Kenn Konstabel
National Institute for Health Development
Hiiu 42
Tallinn
Estonia
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org
On Tue, Mar 29, 2011 at 10:20 AM, Vincy Pyne vincy_p...@yahoo.ca wrote:
Dear R helpers
Suppose I have a vector as
vect1 = as.character(c(ABC, XYZ, LMN, DEF))
vect1
[1] ABC XYZ LMN DEF
I want to reverse the order of this vector as
vect2 = c(DEF, LMN, XYZ, ABC)
rev(vect1)
Kindly guide
Hi Alex,
lapply is not a substitute for for, so it not only does things
differenly, it does a different thing.
Shadowlist-array(data=NA,dim=c(dimx,dimy,dimmaps))
for (i in c(1:dimx)){
Shadowlist[,,i]-i
}
Note that your test case is not reproducible as you haven't defined
dimx, dimy,
It could be done in a large number of ways depending on how often you
need it etc.
You might take a look at defmacro in package gtools:
# library(gtools)
setNA - macro(df, var, values)
{
df$var[df$var %in% values] - NA
}
then instead of
dat0[dat0$e1dq==-999.,e1dq] - NA
you could
Regards,
Kenn
Kenn Konstabel
National Institute for Health Development
Hiiu 42
Tallinn
On Thu, Mar 31, 2011 at 2:50 AM, William Dunlap wdun...@tibco.com wrote:
The %...% operators are not a panacea.
they have the same precedence as `*`
and `/` (I think) so you get things like:
x %-% 10 - 8
n Thu, Mar 31, 2011 at 3:56 PM, Alexander Engelhardt
a...@chaotic-neutral.de wrote:
Am 31.03.2011 14:41, schrieb Sarah Goslee:
On Thu, Mar 31, 2011 at 8:14 AM, Alexander Engelhardt
this helps, thank you.
But if this code is in a function, and some user supplies a vector, I
will
still have
On Thu, Mar 31, 2011 at 9:04 PM, Shi, Tao shida...@yahoo.com wrote:
This question has been asked by many people already. The easiest way is:
1) install the new version
2) copy all or the libraries that you installed later from the library
folder
of older version to the new version
3)
On Tue, Apr 5, 2011 at 10:40 AM, Lorenzo Cattarino
l.cattar...@uq.edu.au wrote:
Hi R-users,
To automate the creation of scripts, I converted the code (example below)
into a character string and wrote the object to a file:
Repeat -
myvec - c(1:12)
cat('vector= ', myvec, '\n')
write
2011/4/8 Juan Carlos Borrás jcbor...@gmail.com:
#Use the indexes of S in a sapply function.
N - 10
S - sample(c(0,1), size=N, replace=TRUE)
v1 - sapply(c(1:N-1), function(i) S[i]S[i+1])
You can achieve the same v1 using
v1.2 - S[2:N-1] S[2:N]
.. or if you insist on having NA as the first
:
# This is a holy Script, please edit it not
Regards,
Kenn Konstabel
There is a way to do this from within R, atleast in Windows XP I have tried
this and it certainly works , The method is very different from the OS
based folder protection route, however making available such a method in
the open
On Mon, Apr 18, 2011 at 2:10 PM, Alaios ala...@yahoo.com wrote:
Dear Andreas,
I would like to thank you for your reply.
I have tried two alternatives but none of the two worked out:
F2[i+1,j+1]-sum(lapply(1:nrow(cells), function(rowInd)
On Mon, Apr 18, 2011 at 4:14 AM, helin_susam helin.su...@gmail.com wrote:
if you have a vector like as follows;
r=c(1,2,3,4,5)
then use
r2=r[1:length(r)-1]
Umm ... this works and gives the intended answer but does so in an ugly way --
1:length(r)-1 is equivalent to (1:length(r))-1 or
regards,
Kenn Konstabel
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
On Mon, Apr 25, 2011 at 4:22 AM, Jim Lemon j...@bitwrit.com.au wrote:
On 04/24/2011 08:13 AM, derek wrote:
Thank you very much. It was the Insert key. It was very annoying. Actually
is
this owerwrite function of any use?
Hi derek,
As Duncan mentioned, it is very useful when one wishes to
On Wed, Apr 27, 2011 at 12:58 PM, Nick Sabbe nick.sa...@ugent.be wrote:
No, that does not work.
You cannot do assignment within (l)apply.
Nor in any other function for that matter.
Yes that may work if you want to.
You can do non-local assignment within lapply using - (and, for that
matter,
The function for getting the year from date is there in package
lubridate (as well as many other convenient functions to work with
dates).
More generally, finding all methods for a given class may be a
little tricky. If all means everything you have installed and
currently attached to your
On Fri, Apr 29, 2011 at 1:03 PM, Michael Bach pha...@gmail.com wrote:
Dear R Users,
I am trying to get the following to work better:
namevec - c(one, two, three)
for (name in namevec) {
namedf - eval(parse(text=paste(name, _df, sep=)))
...
...
}
The rationale behind it being
On Mon, May 2, 2011 at 2:19 PM, abhagwat bhagwatadi...@gmail.com wrote:
Well, what would be really helpful is to restrict the scope of all
non-function variables, but keep a global for scope of all function
variables. Then, you still have access to all loaded functions, but you
don't mix up
Hi Lorenzo,
On Thu, May 5, 2011 at 8:38 AM, Lorenzo Cattarino l.cattar...@uq.edu.au wrote:
Hi R users
I was wondering on how to use lapply co when the applied function has a
conditional statement and the output is a 'growing' object.
See example below:
list1 - list('A','B','C')
list2 -
is(x)
[1] htest
# take a look at stats:::print.htest
format.pval(x$p.value)
[1] 2.22e-16
Does that answer your question?
KK
On Mon, Oct 3, 2011 at 10:53 AM, Liviu Andronic landronim...@gmail.com wrote:
Dear all
How does print.htest display the p-value in scientific notation?
(x -
On Fri, Oct 21, 2011 at 3:09 AM, kickout kyle.ko...@gmail.com wrote:
So i have a simple function:
bmass=function(y){
weight=y$WT*y$MSTR
return(bio)
}
But this just returns bio and since an object with that name is not
defined in the function, it will be looked up in the global
environment
and then
start adding something to it) more obvious. Besides, NULL is quicker
and more efficient.
Sorry for not giving any useful advice, it's late here.
Best regards,
Kenn Konstabel
On Tue, Oct 25, 2011 at 3:19 PM, Delia Shelton delss...@indiana.edu wrote:
Hi,
I'm trying to execute the same R code
Hi hi,
It is much easier to deal with lists than a large number of separate
objects. So the first answer to your question
How can I apply a function to a list of variables.
.. might be to convert your list of variables to a regular list.
Instead of ...
monday - 1:3
tuesday - 4:7
wednesday -
It's a bit dangerous to call them betas in this list. Standardized
regression coefficients sounds much better :)
A simple way is to first standardize your variables and then run lm again.
lm(scale(height)~scale(age) + factor(sex))
# or, depending on what you want:
I'd've first said it's simply
sapply(df1$time, function(x) if(any(foo - (x=df2$from
x=df2$to))0) df2$value[which(foo)] else NA )
but the following are much nicer (except that instead of NA you'll
have 0 but that's easy to change if necessary):
colSums(sapply(df1$time, function(x) (x=df2$from
On Tue, May 24, 2011 at 4:01 AM, Jim Holtman jholt...@gmail.com wrote:
untested
x - lapply(names(infert),function(a)table(infert[[a]]))
This part can be simpler:
lapply(infert,table)
But extending it to the rest of the problem (i.e., 2-way tables) is
not trivial and can be confusing.
# 1
You might use dir() to get the file names (if they are in the same
folder), or something like dir(pattern=^file.*) if you want to read
only some files from there. Then for storing the result as something
like store[i,j] as in your example, you could split the file name
using something like
An alternative approach would be to `split` the data frame by family,
then `lapply` a function selecting random row from each slice, and
then `rbind` it all together.
x = data.frame(family = rep(1:20,sample(2:5,20,replace=TRUE)), xyz=1)
randomrow - function(x) x[sample(1:nrow(x),1),]
# step by
Or without plyr:
# Dennis's sample data but with shortened names
ds - data.frame(id = rep(1:3, each = 10),
value1 = sample(seq_len(100), 30, replace = TRUE))
k - data.frame(id = 1:3, sv = c(1, 3, 5))
do.call(rbind,
mapply( function(a,b) subset(ds, id==a)[-1:-b,],
On Fri, May 27, 2011 at 11:27 AM, Albert-Jan Roskam fo...@yahoo.com wrote:
Aha! Thank you very much for that clarification! It would be much more user
friendly if R generated a NotImplementedError or something similar. The
'garbage
results' are pretty misleading, esp. to a novice.
I wanted
1 - 100 of 127 matches
Mail list logo