Good day,
Your Kenn Konstabel invoice is available
Sincerely,
Kenn Konstabel
T: 0865 102 7899
e-Mail:lebats...@gmail.com
We are committed to reducing its impact on the environment. Please don't print
this email unless absolutely necessary.
___
-8-BOM" reads in the file correctly.
On Thu, Jul 10, 2014 at 5:50 PM, Duncan Murdoch
wrote:
> On 10/07/2014 9:53 AM, Kenn Konstabel wrote:
>>
>> Wow. Thanks a lot!
>>
>> source("http://psych.ut.ee/~nek/R/test-utf8.txt";, encoding="UTF-8-BOM")
Wow. Thanks a lot!
source("http://psych.ut.ee/~nek/R/test-utf8.txt";, encoding="UTF-8-BOM")
# works correctly on my Windows 7 machine
# (and without encoding argument it still crashes R)
Kenn
On Thu, Jul 10, 2014 at 4:33 PM, John McKown
wrote:
> On Thu, Jul 10, 2014 at
e
everything worked).
Context:
I was trying to find out how to make files that could be source'd on
both windows and linux. This is partly solved so I have no specific
question other than "is this a bug in windows version?" but any
comments on the general topic
you can extract numbers from your file names and then sort them like this:
filelist = list.files(pattern = ".s*.txt")
filelist[order(as.integer(gsub("[^0-9]", "", filelist)))]
(cf with alphabetic order: filelist[order(gsub("[^0-9]", "", filelist))]
Or if you just have s1...s120 you can construct
deleting the old rownames might help.
rownames(df1) <- rownames(df2) <- rownames(df3) <- NULL
But a reproducible example would be interestng. In simple cases there
is no problem with "duplicated" rownames as they are automatically
renamed:
> df1 <- data.frame(A=1, B=2, row.names="A")
> df2 <- da
On Wed, Sep 18, 2013 at 12:14 PM, Pascal Oettli wrote:
> It's a function of package "sos", quite useful to find functions in R.
>
>
> It is interesting to note that neither RSiteSearch("cov2cor") nor
findFn("cov2cor") seem to be able to find cov2cor (from the stats package!
so it's there on every
Hi,
> What does every line mean especially the expression
> [1L], [2L], and
> (1L:p, 1L:p)
1L, 2L etc are integers. (That is, identical to as.integer(1) ,
as.integer(2) etc)
Using integers (instead of "numeric" type) is more efficient as here
they're used as indexes and would be converted to int
or without plyr you could do, e.g.,
aggregate(df2aggregate[,-1], df2aggregate["id"], function(..)
if(is.numeric(..)) mean(..) else if(is.character(..)) ..[1])
Kenn
On Mon, May 13, 2013 at 1:30 AM, Spencer Graves <
spencer.gra...@structuremonitoring.com> wrote:
> Hi, Arun: Thanks. That's exac
C("bincount", ..., PACKAGE = "base")
Packages should not make .C/.Call/.Fortran calls to base packages. They
are not part of the API, for use only by R itself and subject to change
without notice."
I understand the reasons but what would be a good solution if I like the
way it
<-cat('"',a,'"',sep="")}
> utf2uxxx("õäöü")
> #"\u00f5\u00e4\u00f6\u00fc"
>
> sessionInfo()
> R version 3.0.0 (2013-04-03)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> A.K.
>
>
>
> - Original Me
this. (I
couldn't find anything useful from searches incl RSiteSearch).
Thanks in advance,
Kenn
-- P.S. Apologies if this is double posted - there was a network error and
the first message doesn't seem to have been sent out (but maybe it was).
Kenn Konstabel
Department of Chroni
It may be easy or difficult depending on what your data are like.
"GALAXY ACE S 5830" vs "S 5830 GALAXY ACE"
One easy and reasonably general way would be to divide each such bit
into 4 "words" and then compare if set 2 contains exactly all words in
set 1 but possibly in different order.
x1 <- "G
e white
background of boxplot; so it might help to make this background
transparent instead of white; but I haven't examined the code so can't
be sure this is what bxp does). Or it might be easier to do it with
ggplot.
Regards,
Kenn Konstabel
On 9/18/12, John Kane wrote:
> Not sure
You can use macros for this effect. Or environments:
daf <- data.frame(a=1:10, b=rnorm(10))
env <- as.environment(daf)
fun <- function(x) x$c <- x$a+x$b
fun(daf)
fun(env)
daf$c
env$c
You can see that the same function (fun) changes one object but leaves
another one unchanged. But before using i
Not really an answer but since you said something about "blessings"
and "spreading the word": I have a small presentation introducing the
time saving aspects of R comparing it to a programme called
Statistica that I used to use but that I now use mainly to convert its
native files to a rreadable f
When you close R it asks whether to save the workspace. I often say
"yes" and later start R by double clicking on that workspace (named
.Rdata) -- then the wd is automatically set. Alternatively you can
have setwd("X:/some/thing") at the beginning of your source file.
On Tue, Aug 14, 2012 at 3:40
Hi,
But what if your professor reads this list?
Anyway, who cares, two hints:
1. It might be useful to read the explanations provided with the
problem. For example, your exercise tells you that "use the help
command ?rexp to read how to generate exponentially distributed
variables". On a careful
On Fri, May 4, 2012 at 3:06 PM, Luis Goncalves wrote:
>
>
> On May 2 2011, 3:02 pm, Kenn Konstabel wrote:
>> On Mon, May 2, 2011 at 2:19 PM, abhagwat wrote:
>> > Well, what would be really helpful is to restrict the scope of all
>> > non-function variables, b
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:
lm(height~scale(age)+factor(
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
table a `name` may be confusing to some readers. And saying that
xx<- c()
... is just another way of saying that xx <- NULL . NULL is clearer
than c() as it makes your intention (to make an empty object and then
start adding something to it) more obvious. Besides, NULL is quicker
and more ef
On Fri, Oct 21, 2011 at 3:09 AM, kickout 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 (workspace) an
> 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 wrote:
> Dear all
> How does print.htest display the p-value in scientific notation?
>> (x <- cor.test(iris
With some guessing: does lm(formula = y ~ -1 + group + x:group, data = dat)
do what you want? I'm not sure now 1:group is treated, if at all.
Kenn
On Tue, May 31, 2011 at 11:35 PM, Kevin Wright wrote:
> For a pedagogical purpose, I was trying to show how the formula for a simple
> regression lin
use "list" instead of "c":
models <- list(model,model)
sapply(models, class)
# [,1] [,2]
# [1,] "svm.formula" "svm.formula"
# [2,] "svm" "svm"
For understanding what c does in your case:
c(list(first=1, second=2), list(third=3, fourth=4))
# compare this with list(list(firs
On Fri, May 27, 2011 at 6:12 PM, Bert Gunter wrote:
> Jonathan et. al:
>
> Yes, of course, but I'd say Type III error: Right answer to wrong question.
> The real question (imho only obviously) is: "What data structure
> should be used?" -- and the standard answer for this sort of thing in
> R is:
On Fri, May 27, 2011 at 11:27 AM, Albert-Jan Roskam 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 to recode
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,], k$i
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 s
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 strspl
On Tue, May 24, 2011 at 4:01 AM, Jim Holtman 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
lapply(infert, fu
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>=df
Hi Lorenzo,
On Thu, May 5, 2011 at 8:38 AM, Lorenzo Cattarino 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 <- c()
>
> myf
On Mon, May 2, 2011 at 2:19 PM, abhagwat 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 variables.
>
> How wou
On Fri, Apr 29, 2011 at 1:03 PM, Michael Bach 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
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 se
On Wed, Apr 27, 2011 at 12:58 PM, Nick Sabbe 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, within any other
On Mon, Apr 25, 2011 at 4:22 AM, Jim Lemon 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 type ove
in a list of 20, and in data entry, checked items
were entered as 1's but the cells corresponding to unchecked items
were left empty ... so I had to replace all NA's with 0's except in
rows with nothing but NA's; there are probably many other legitimate
examples).
Best regards,
Kenn Ko
On Mon, Apr 18, 2011 at 4:14 AM, helin_susam 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 0:(length(r)-1) --
On Mon, Apr 18, 2011 at 2:10 PM, Alaios 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)
> Fwithcellvalue(i=i,j=j,a=cells[rowInd,2],b=cells[rowInd,4],c=cel
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 for
2011/4/8 Juan Carlos Borrás :
> #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 elemen
On Tue, Apr 5, 2011 at 10:40 AM, Lorenzo Cattarino
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 (Repeat,
On Thu, Mar 31, 2011 at 9:04 PM, Shi, Tao 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) uninstall the
n Thu, Mar 31, 2011 at 3:56 PM, Alexander Engelhardt
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 to r
t; a %<-% 1000 + 1
[1] 1001
> a
[1] 1000
Regards,
Kenn
Kenn Konstabel
National Institute for Health Development
Hiiu 42
Tallinn
On Thu, Mar 31, 2011 at 2:50 AM, William Dunlap wrote:
> The %...% operators are not a panacea.
> they have the same precedence as `*`
> and `/` (I th
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 coul
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
On Tue, Mar 29, 2011 at 10:20 AM, Vincy Pyne 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(vect
ter these changes, [ and length would work "correctly" (in my
possibly naive understanding), and length(trunc(foo, "day")) would
return 10 in the example above.
Best regards,
Kenn
Kenn Konstabel
National Institute for Health Development
Hiiu 42
Tallinn
Estonia
_
Hi Knut,
On Fri, Mar 25, 2011 at 10:43 AM, Knut Krueger 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 ... ... ... Xn/Y
On Thu, Mar 24, 2011 at 1:29 PM, Michael Bach 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 fo
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 Wed, Mar 23, 2011 at 11:13 AM, Zablone Owiti 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'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 <- fun
On Tue, Mar 22, 2011 at 3:05 PM, Tonja Krueger 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
> 19.07.1956
On Mon, Mar 21, 2011 at 5:57 PM, 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
> keeping the d
On Mon, Mar 21, 2011 at 2:53 PM, Gabor Grothendieck wrote:
> On Mon, Mar 21, 2011 at 8:46 AM, Kenn Konstabel
> wrote:
> > Dear all,
> >
> > I sometimes use the following function:
> >
> > Curry <- function(FUN,...) {
> > # by Byron Ellis,
&g
e. (And neither is replacing "[" with "Curry" by using
substitute et al. inside `foo`, - this would make it usable only within
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
t
On Sun, Mar 20, 2011 at 12:43 PM, Duncan Murdoch
wrote:
> On 11-03-19 10:21 PM, Kenn Konstabel wrote:
>
>> On Sun, Mar 20, 2011 at 4:13 AM, Kenn Konstabel
>> wrote:
>>
>> you can omit the list and do the following:
>>>
>>>
>>> /.../
>&
On Sun, Mar 20, 2011 at 4:13 AM, Kenn Konstabel 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
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
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
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 sa
Hi,
> returns.z = tail(prices.z,-1)/head(prices.z,-1) - 1 # should be equivalent
> to returns = exp(diff(log(prices.z))) - 1
>
> Curiously, I get a zoo object back with zeros everywhere and also with the
> index having one fewer element than it should.
>
> Does anyone know how to pointwise divid
graphics grDevices utils datasets methods base
other attached packages:
[1] RODBC_1.3-2
loaded via a namespace (and not attached):
[1] iterators_1.0.3 tools_2.12.1
Thanks in advance,
Kenn
Kenn Konstabel
Department of Chronic Diseases
National Institute for He
On Wed, Feb 18, 2009 at 9:21 PM, dobomode wrote:
> I am trying to import a large dataset from SPSS into R. The SPSS file
> is in .SAV format and is about 1GB in size. I use read.spss to import
> the file and get an error saying that I have run out of memory. I am
> on a MAC OS X 10.5 system with
On Thu, Feb 3, 2011 at 1:16 PM, Alaios wrote:
> I am sorry that I did not provide all the required data (for me is not very
> straight-forward to understand what I have to provide and what not)
>
>
> findCell<-function(x,sr){ # It is just for me understand how mapply works
> sr[x[1],x[2]
On Thu, Feb 3, 2011 at 1:26 PM, Albert-Jan Roskam wrote:
> Hi,
>
> I have a function myFun which I want to call multiple times, using
> different
> argument lists.
> myFun("v1", "2009", 1)
> myFun("v2", "2008", 1)
> myFun("q", "2001")
>
Notice that the third call is different, you have 3 args in
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 Thu, Sep 3, 2009 at 5:50 AM, Peter Meilstrup
wrote:
> 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
> structure fiel
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 yo
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 <- expression(NA_char
On Wed, Aug 5, 2009 at 11:28 PM, Erik Iverson 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
> may be no
On Thu, Jul 2, 2009 at 4:34 AM, Rolf Turner 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, Jul 1, 2009 at 3:02 AM, gug 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 seems to work).
>
On Tue, Jun 30, 2009 at 2:36 PM, gug 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 headings within the re
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
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 wrote:
> Hey,
>
> that is very cool! But there is
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
save(mumbo, file="head of mumbo")
# now
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
for you.
>
> >
> > Not an expert in statistics myself, I am mostly concentrating on the
> > programming aspects of R. Problem is that I suspect my colleagues who
> > are providing some guidance with the stats end are not quite experts
> > themselves, and certainly new
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
# lm(DAX
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=FA
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(), ge
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_time
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[[
is cleverer and much less obscure than I
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
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 `<-
approach.
>
> The optimal use of round is using in last calculation:
>
> Look this
>
> > round(8.8,1)-round(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
> N
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
be
interesting to know what is happening here.. i.e., why 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 Da
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
> develo
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, d$NKids+d$
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 re
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
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)
> x2<-c(2,3,4,3,4,3,4,2,2,3,4
(x[1])?
So I assume that what you meant is actually something like 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...
> >
> &g
1 - 100 of 130 matches
Mail list logo