Displaying 20 results from an estimated 10000 matches similar to: "Paste() - Get all possible combinations from multiple vectors"
2012 Nov 15
1
Extracting list names within a looped function
Hello all,
I have the following problem:
1) A list was defined as 'a'
a <- list("var1"=c(100:1), "var2"=c(1:100), "var3"=rnorm(100))
2) a function 'foo' was defined that extracts the variable name assigned to x using the deparse(substitute()) functionality. This name will then be used within the function to generate specific output files, etc.
2007 Aug 06
2
used the described Class in a shared behavior
Is it possible to access the described class in a shared behavior? I''m
trying to do something like this:
describe "Siberian feline", :shared => true do
described_class_instance_as :feline, :name => "fluffy", :breed =>
"Siberian"
# or maybe
before(:all) do
@feline = described_class.new(:name => "fluffy", :breed =>
2010 Nov 02
1
splitting First 10 words in a string
Hi Steven,
Thank you for the help. I get an error though when i do this :
>lit<-read.csv("litologija.csv", sep=";", dec=".")
>sent <-data.frame(sentence=lit$Opis,stringsAsFactors=FALSE)
>str(sent)
>sentV<-rep(sent,10)
>str(sentV)
>first=second=third=fourth=fifth=sixth=seventh=eighth=ninth=tenth<-vector(length=10)
>DF
2010 Dec 10
3
(no subject)
Hi R-help,
I am trying to find a way to select five highest values in data frame
according some variable. I will demonstrate:
c
X1 X2
1 1 1
2 1 2
3 1 3
4 1 4
5 1 5
6 1 6
7 1 7
8 1 8
9 1 9
10 1 10
11 2 11
12 2 12
13 2 13
14 2 14
15 2 15
16 2 16
17 2 17
18 2 18
19 2 19
20 2 20
21 2 21
22 2 22
23 2 23
24 2 24
25 2 25
So I
2013 Mar 20
3
highlight overlapping region of two densities
Hi all.
I would like to highlight overlapping regions of two densities and I could
not find a way to do it.
Here is the sample code:
myd <- c(2,4,5, 4,3,2,2,3,3,3,2,3,3,4,2,4,3,3,3,2,2.5,
2, 3,3, 2.3, 3, 3, 2, 3)
myd1 <- myd-2
plot(range(density(myd)$x, density(myd1)$x), range(density(myd)$y,
density(myd1)$y), type = "n")
lines(density(myd), col=1, lwd=4)
2011 Mar 14
2
data.frame transformation
Hi R users,
I have following data frame
df<-data.frame(q1=c(0,0,33.33,"check"),q2=c(0,33.33,"check",9.156),
q3=c("check","check",25,100),q4=c(7.123,35,100,"check"))
and i would like to replace every element that is less then 10 with . (dot)
in order to obtain this:
q1 q2 q3 q4
1 . . check .
2 . 33.33 check 35
2011 Dec 04
3
RODBC connect to Excel (64-bit Windows 7)
Hi to all.
I have a problem to connect to an Excel database using RODBC.
Namely, I am using 64-bit R 2.14.0, under Windows 7 and I tried following:
library(RODBC)
> channel <- odbcConnectExcel("results.xlsx")
Error in odbcConnectExcel("results.xlsx") :
odbcConnectExcel is only usable with 32-bit Windows # ok this is
clear why it doesn't work
> channel
2012 Nov 22
2
lapack routines cannot be loaded [Help request]
Dear BioConductor and R fellow users
I apologize in advance for double posting, but I am not sure which list would actually be best fit for this message.
I am experiencing a weird error with my R installation on Ubuntu 10.04.4 (LTS) 64bit:
When I run R on the terminal everything goes smoothly:
$R
R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation
2011 Mar 16
2
export list to csv
Hi everybody.
I have list like this:
l<-list(data.frame(q1=c(1,2,"check"),q2=c(3,"check",5)),
data.frame(q1=c("check",1),q2=c(4,5)))
names(l)<-c("A","B")
rownames(l[[1]])<-c("aa","bb","cc")
rownames(l[[2]])<-c("aa","bb")
Every object has the same number of columns but different number
2010 Sep 21
5
Combined plot: Scatter + density plot
Hi,
in order to save space for a publication, it would be nice to have a
combined scatter and density plot similar to what is shows on
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=78
I wonder if anybody perhaps has already developed code for this and is
willing to share. This is the reproducible code for the histogram
version obtained from the site:
def.par <-
2011 Apr 12
2
Converting a categorical variable to multiple dichotemous variables
I have a categorical variable in a dataframe similar to the following...
cat
1
1
3
2
4
I need to convert it to 4 dichotemous variables for each observations like...
cat1 cat2 cat3 cat4
1 0 0 0
1 0 0 0
0 0 1 0
0 1 0 0
0 0 0 1
Thanks in advance!
Shane
2010 Jan 21
3
single stream performance issue, Win2K, WinXP, Samba 3.2.5-4lenny7 (Debian Lenny)
Hello fellow Samba users and devs. This is my first post. I've searched
documentation far and wide for Windows, Linux, and Samba, and have not been able
to shed any light on this issue.
I can't get more than 8MB/s during a single file copy stream out of my Samba
server over my 100FDX switched network either from Win2K or WinXP (I don't have
a *nix client to test with). The network
2020 Apr 30
3
Use of MathJax (or something similar) in .Rd files
Hello All,
I am wondering if there has ever been any discussion/consideration given to incorporating MathJax (or something similar) into R for rendering equations in .Rd files. I know that equations are rendered beautifully in the pdf manuals, but I suspect the majority of users primarily look at the html help files when using R. While I am comfortable reading something like "B_x(a,b) =
2020 Apr 30
2
Use of MathJax (or something similar) in .Rd files
Thanks Gabor and Duncan! It works. For those interested, I added this to the beginning of the \details{} section:
\if{html}{\out{
<script id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax at 3/es5/tex-mml-chtml.js">
</script>
}}
And then I can use:
\if{html}{\out{\(B_{x(a,b)} = \int_0^x t^{a-1} (1-t)^{b-1} dt\)}}
or
2017 Oct 09
2
Discourage the weights= option of lm with summarized data
Yes. Thank you; I should have quoted it.
I suggest to remove this text or to add the word "not" at the beginning.
Arie
On Sun, Oct 8, 2017 at 4:38 PM, Viechtbauer Wolfgang (SP)
<wolfgang.viechtbauer at maastrichtuniversity.nl> wrote:
> Ah, I think you are referring to this part from ?lm:
>
> "(including the case that there are w_i observations equal to y_i and
2017 Oct 08
2
Discourage the weights= option of lm with summarized data
Indeed: Using 'weights' is not meant to indicate that the same
observation is repeated 'n' times. As I showed, this gives erroneous
results. Hence I suggested that it is discouraged rather than
encouraged in the Details section of lm in the Reference manual.
Arie
---Original Message-----
On Sat, 7 Oct 2017, wolfgang.viechtbauer at maastrichtuniversity.nl wrote:
Using
2011 Aug 10
1
subqueries in sqlQuery function (package RODBC)
Hi R users.
sorry for missing example and if question is to general but I am wondering
if it is possible to execute subqueries in function sqlQuery (package RODBC)
with opened connection with Excel or SQL server 2000. I couldn't find any
example of this.
And if it is possible what should be a correct syntax for this query:
SELECT ct,COUNT(*) as n
FROM (SELECT COUNT(*) AS ct FROM children
2010 Dec 11
2
package sampling
Hi R users.
I have a problem with function strata in sampling packages.
> st0 = strata(dom, stratanames="stratas", size=sample.size,
method="systematic",pik, FALSE)
Error in sort.list(y) : 'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?
In previous version of R 2.9.1 and previous version of package sampling this
code worked
2010 Dec 19
1
package survey
Hi R users,
could someone help me to find out which formulas, for standard error
calculation, are used in following example:
a=data.frame(weights=rep(c(10,1),c(4,1)),fpc=rep(41,5),uk=rep(1,5))
srs<-svydesign(id=~1, weights=~weights, data=a)
srs1<-svydesign(id=~1, weights=~weights,fpc=~fpc, data=a)
svytotal(~uk,srs)
total SE
uk 41 9
svytotal(~uk,srs1)
total SE
uk 41
2011 Dec 08
1
sum of deviations from the weighted mean
Hi all. I tried to calculate sum of deviations from the weighted mean and i
didn't get what i expected - 0. Here is an example:
> wt <- c(10,25,38,22,5)
> x <- 6:10
> wm <- weighted.mean(x,wt)
> (x-wm)*wt
[1] -18.70 -21.75 4.94 24.86 10.65
> sum((x-wm)*wt)
[1] -1.24345e-14
With simple mean I got 0:
> sum(x-mean(x))
[1] 0
Could someone explain me why we