Displaying 20 results from an estimated 82 matches for "steingold".
2011 Jul 11
1
plot means ?
Hi,
I need this plot:
given: x,y - numerical vectors of length N
plot xi vs mean(yj such that |xj - xi|<epsilon)
(running mean?)
alternatively, discretize X as if for histogram plotting and plot mean y
over the center of the histogram group.
is there a simple way?
thanks!
--
Sam Steingold (http://sds.podval.org/) on CentOS release 5.6 (Final) X 11.0.60900031
http://thereligionofpeace.com http://camera.org http://jihadwatch.org
http://palestinefacts.org http://pmw.org.il http://ffii.org
Flying is not dangerous; crashing is.
2013 Jan 04
4
non-consing count
...t;- c(1,1,0,0,0)
count.0 <- length(which(x == 0))
--8<---------------cut here---------------end--------------->8---
however, this approach allocates and discards 2 vectors: a logical
vector of length=length(x) and an integer vector in which.
is there a cheaper alternative?
Thanks!
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://iris.org.il http://honestreporting.com
http://jihadwatch.org http://pmw.org.il http://www.PetitionOnline.com/tap12009/
War doesn't determine who's right, just who's left.
2012 Aug 28
5
variable scope
...end of a for loop its variables are still present:
for (i in 1:10) {
x <- vector(length=100000000)
}
ls()
will print "i" and "x".
this means that at the end of the for loop body I have to write
rm(x)
gc()
is there a more elegant way to handle this?
Thanks.
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://camera.org http://palestinefacts.org
http://iris.org.il http://www.PetitionOnline.com/tap12009/ http://truepeace.org
Computers are like air conditioners: they don't work with open windows!
2013 Jan 18
5
select rows with identical columns from a data frame
...40),c=c(1,NA,5,40))
> f
a b c
1 1 1 1
2 NA NA NA
3 NA 3 5
4 4 40 40
--8<---------------cut here---------------end--------------->8---
I want the vector TRUE,FALSE,FALSE,FALSE selecting just the first
row because there all 3 columns are the same and none is NA.
thanks!
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://memri.org http://mideasttruth.com
http://honestreporting.com http://pmw.org.il http://iris.org.il
All extremists should be taken out and shot.
2011 Jul 12
3
when to use `which'?
when do I need to use which()?
> a <- c(1,2,3,4,5,6)
> a
[1] 1 2 3 4 5 6
> a[a==4]
[1] 4
> a[which(a==4)]
[1] 4
> which(a==4)
[1] 4
> a[which(a>2)]
[1] 3 4 5 6
> a[a>2]
[1] 3 4 5 6
>
seems unnecessary...
--
Sam Steingold (http://sds.podval.org/) on CentOS release 5.6 (Final) X 11.0.60900031
http://jihadwatch.org http://palestinefacts.org http://mideasttruth.com
http://truepeace.org http://thereligionofpeace.com
Good programmers treat Microsoft products as damage and route around it.
2012 Sep 19
4
where are these NAs coming from?
...------------>8---
> length(which(is.na(z$language)))
[1] 0
> locals <- z[z$country == mycountry,]
> length(which(is.na(locals$language)))
[1] 229
--8<---------------cut here---------------end--------------->8---
where are those locals without the language coming from?!
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://ffii.org http://honestreporting.com
http://camera.org http://www.memritv.org http://dhimmi.com
I don't like cats! -- Come on, you just don't know how to cook them!
2012 Feb 08
4
"unsparse" a vector
...pairs
(fixed width, in this example both value and name are 1 character, in
reality the column name is 6 chars and value is 2 digits).
I need to convert it to a data frame:
data.frame(A=c(1,3,0,7),B=c(2,0,5,8),C=c(0,4,0,6))
A B C
1 1 2 0
2 3 0 4
3 0 5 0
4 7 8 6
how do I do that?
thanks.
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://mideasttruth.com http://jihadwatch.org http://pmw.org.il
http://openvotingconsortium.org http://iris.org.il http://memri.org
What's the difference between Apathy & Ignorance? -I don't know and don't care!
2006 May 11
3
cannot turn some columns in a data frame into factors
...;\n")
the output is:
Month ( 1 ): TRUE
factors: FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
i.e., there is a column named "Month" (the 1st column), and it is indeed
turned into a factor inside sapply(), but after that it is numerical
again!
what am I doing wrong?
--
Sam Steingold (http://www.podval.org/~sds) on Fedora Core release 5 (Bordeaux)
http://honestreporting.com http://truepeace.org http://openvotingconsortium.org
http://thereligionofpeace.com http://memri.org http://palestinefacts.org
UNIX, car: hard to learn/easy to use; Windows, bike: hard to learn/hard to use.
2012 Dec 04
3
list to matrix?
...),
c(450000, 19), c(5e+05, 16))
as.matrix(a)
[,1]
[1,] Numeric,2
[2,] Numeric,2
[3,] Numeric,2
[4,] Numeric,2
[5,] Numeric,2
[6,] Numeric,2
[7,] Numeric,2
[8,] Numeric,2
[9,] Numeric,2
--8<---------------cut here---------------end--------------->8---
thanks!
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://palestinefacts.org http://dhimmi.com
http://jihadwatch.org http://www.PetitionOnline.com/tap12009/ http://memri.org
Rhinoceros has poor vision, but, due to his size, it's not his problem.
2012 Sep 19
2
drop zero slots from table?
...-
all the time.
I am wondering if the "drop 0" (and maybe even sort?) can be effected by
some magic argument to table() which I fail to discover in the docs?
Obviously, I could use droplevels() to avoid 0 counts in the first
place, but I do not want to drop the levels in the data.
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://ffii.org http://truepeace.org
http://www.memritv.org http://honestreporting.com http://dhimmi.com
MS Windows: error: the operation completed successfully.
2012 Aug 30
3
apply --> data.frame
Is there a way for an apply-type function to return a data frame?
the closest thing I think of is
foo <- as.data.frame(sapply(...))
names(foo) <- c(....)
is there a more "elegant" way?
Thanks!
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://palestinefacts.org http://dhimmi.com
http://honestreporting.com http://ffii.org http://mideasttruth.com
Lisp: it's here to save your butt.
2012 Feb 10
2
the value of the last expression
Is there an analogue of common lisp "*" variable which contains the
value of the last expression?
E.g., in lisp:
> (+ 1 2)
3
> *
3
I wish I could recover the value of the last expression without
re-evaluating it.
thanks
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://www.childpsy.net/ http://camera.org http://ffii.org
http://truepeace.org http://memri.org http://americancensorship.org
The early bird may get the worm, but the second mouse gets the cheese.
2012 Nov 07
3
c weirdness
...39;t want ".0"!
1 2344600
> c("nons"=1, "seed"=tab[2])
nons seed.1 ## don't want ".1"!
1 6843
> tab
0 1
2344600 6843
--8<---------------cut here---------------end--------------->8---
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://pmw.org.il
http://memri.org http://ffii.org http://openvotingconsortium.org
Islam is a religion of Peace. Its adherents will kill anyone who disagrees.
2011 Dec 21
4
qqnorm & huge datasets
Hi,
When qqnorm on a vector of length 10M+ I get a huge pdf file which
cannot be loaded by acroread or evince.
Any suggestions? (apart from sampling the data).
Thanks.
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://mideasttruth.com http://honestreporting.com http://camera.org
http://openvotingconsortium.org http://pmw.org.il http://thereligionofpeace.com
A person without flaws probably lacks strengths either.
2006 Mar 17
6
removing NA from a data frame
...R, so a detailed step-by-step
explanation with code samples would be nice).
Some columns (variables) have quite a few NAs, so I would rather drop
the whole column than sacrifice all the rows (observations) which have
NA in that column.
How do I remove a column from a data frame?
Thanks!
--
Sam Steingold (http://www.podval.org/~sds) on Fedora Core release 4 (Stentz)
http://ffii.org http://www.mideasttruth.com http://pmw.org.il
http://www.dhimmi.com http://www.honestreporting.com http://www.jihadwatch.org
Don't hit a man when he's down -- kick him; it's easier.
2012 Dec 27
4
vectorization & modifying globals in functions
...sapply(1:1e6,update))
--8<---------------cut here---------------end--------------->8---
however, the global d is not modified, apparently update modifies the
local copy.
so,
1. is there a way for a function to modify a global variable?
2. how would you vectorize this loop?
thanks!
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://honestreporting.com
http://pmw.org.il http://www.PetitionOnline.com/tap12009/
A number problem "solved" with floats turns into 1.9999999999999998 problems.
2017 Nov 09
2
[R-pkgs] Release of ess 0.0.1
...1-09 00:02:53 +0100]:
>
> I'm happy to announce the release of ess 0.0.1 a package designed to
> download data from the European Social Survey
Given the existence of ESS (Emacs Speaks Statistics -
https://ess.r-project.org/) the package name "ess" seems unfortunate.
--
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net http://iris.org.il
http://mideasttruth.com http://thereligionofpeace.com https://jihadwatch.org
MS Windows: error: the operation completed successfully.
2011 Feb 15
2
strptime format = "%H:%M:%OS6"
...hen I do
> options("digits.secs"=6);
> all$X.Time <- strptime(all$X.Time, format = "%H:%M:%OS");
and it, apparently, works:
> all$X.Time[2]-all$X.Time[1]
Time difference of 5.12188 secs
so, why doesn't format = "%H:%M:%OS6" work as documented?
--
Sam Steingold (http://sds.podval.org/) on CentOS release 5.3 (Final)
http://dhimmi.com http://openvotingconsortium.org http://palestinefacts.org
http://honestreporting.com http://www.memritv.org http://camera.org
There are two kinds of egotists: 1) Those who admit it 2) The rest of us
2012 Feb 23
5
cor() on sets of vectors
...a _matrix_ of all pairwise correlations:
cor(x,y)
d e f
a 0.2763696 -0.3523757 -0.373518870
b 0.5892742 -0.1969161 -0.007159589
c 0.3094301 0.1111997 -0.094970748
which is _not_ what I want.
I want diag(cor(x,y)) but without the N^2 calculations.
thanks.
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://www.childpsy.net/ http://iris.org.il http://americancensorship.org
http://dhimmi.com http://www.PetitionOnline.com/tap12009/ http://jihadwatch.org
Never argue with an idiot: he has more experience with idiotic arguments.
2012 Nov 19
2
generated list element names
...more
elegant way than
--8<---------------cut here---------------start------------->8---
> z <- list(10)
> names(z) <- paste("f","oo",sep="")
> z
$foo
[1] 10
--8<---------------cut here---------------end--------------->8---
thanks!
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://www.memritv.org
http://thereligionofpeace.com http://truepeace.org
Unix roulette: `dd if=/dev/urandom of=/dev/kmem bs=1 count=1 seek=$RANDOM`