Displaying 20 results from an estimated 100 matches similar to: "bootstrapping data.frame and matrix"
2018 May 24
0
Manipulation of data.frame into an array
This is one of those instances where a less superficial knowledge of R's
technical details comes in really handy.
What you need to do is convert the data frame to a single (numeric) vector
for, e.g. a matrix() call. This can be easily done by noting that a data
frame is also a list and using do.call():
## imp is the data frame:
do.call(c,imp)
X11 X12 X13 X14 X15 X16 X17 X18 X19
2018 May 24
2
Manipulation of data.frame into an array
Hello everyone,
Thank you for this. Nonetheless it is not exactly want i need.
I need mydata[[1]] to provide the values for all 3 variables (Y, X1 and X2) of the first imputation only. As it stands it returns the whole database.
Any ideas?
Best,
ioanna
________________________________
From: Bert Gunter <bgunter.4567 at gmail.com>
Sent: 24 May 2018 16:04
To: Ioanna Ioannou
Cc:
2018 May 24
4
Manipulation of data.frame into an array
Hello everyone,
I want to transform a data.frame into an array (lets call it mydata), where: mydata[[1]] is the first imputed dataset...and for each mydata[[d]], the first p columns are covariates X, and the last one is the outcome Y.
Lets assume a simple data.frame:
Imputed = data.frame( X1 = c(1,2,1,2,1,2,1,2, 1,2,1,2,1,2,1,2),
X2 =
2008 Dec 22
1
sorting variable names containing digits
Dear r-helpers,
I'm looking for a way of sorting variable names in a "natural" order, when
the names are composed of digits and other characters. I know that this is a
vague idea, and that sorting character strings is a complex topic, but
perhaps a couple of examples will clarify what I mean:
> s <- c("x1b", "x1a", "x02b", "x02a",
2009 Apr 11
2
who happenly read these two paper Mohsen Pourahmadi (biometrika1999, 2000)
http://biomet.oxfordjournals.org/cgi/reprint/86/3/677 biometrika1999
http://biomet.oxfordjournals.org/cgi/reprint/94/4/1006 biometrika2000
Hi All:
I just want to try some luck.
I am currenly working on my project,one part of my project is to
reanalysis the kenward cattle data by using the method in Mohsen's paper,but
I found I really can get the same or close output as he did,so,any
2010 May 28
3
Using a loop to define new variables
Hi,
I'm a novice R user, much more used to SAS. My problem is pretty simple - basically, in a data frame, I have variables named
x1,....,x10 and y1,...,y10; and I would like to create r1 = x1 / y1 etc
Apologies if this is way too rudimentary - but I couldn't find any posts online which solve this exact issue.
Cheers,
Andre
2002 Aug 20
2
Reset par(xaxp) in plot
R-Helpers;
This seems simple to set graphic parameter, but I tried plot a graph
with 10 intervals in x axis with par(xaxp = c(0, 150, 10) but to no avail:
par(xaxp =c (0, 150, 10))
plot(age, y18, type="n", ylab="Height (m)", xlab=" age (Yrs)", font
= 2)
lines(age, y6, lty = 4, lwd = 2)
lnes(age, y10, lty = 1, lwd =2)
lines(age, y14, lty = 2, lwd =2)
2011 Aug 25
4
{R} How to extract correctly from vector?
Dear list,
I have problem that I cannot solve and would like to ask your opinion. I
tried to ask a few days ago already but got no answer and all my attempts to
solve it by myself since then failed. Sorry for repeated posting! Here the
problem broken down a bit.
My problem basically is, that I want to use the elements of a character
vector as names for objects and by recalling only the
2019 Apr 24
1
Bug in "stats4" package - "confint" method
Dear R developers,
I noticed a bug in the stats4 package, specifically in the confint method applied to ?mle? objects.
In particular, when some ?fixed? parameters define the log likelihood, these parameters are stored within the mle object but they are not used by the ?confint" method, which retrieves their value from the global environment (whenever they still exist).
Sample code:
>
2012 Oct 03
1
Errors when saving output from WinBUGS to R
Dear all
I used R2WinBUGS package's bugs() function to generate MCMC results. Then I
tried to save the simulation draws in R, using read.bugs() function. Here is
a simple test:
######################
library(coda)
library(R2WinBUGS)
#fake some data to test
beta0=1
beta1=1.5
beta2=-1
beta3=2
N=200
x1=rnorm(N, mean=0,sd=1)
x2=rnorm(N, mean=0,sd=1)
x3=rnorm(N, mean=0,sd=1)
lambda2= exp(beta0+
2007 Aug 07
1
Error in as.double.default(x) : (list) object cannot be coerced to 'double'
Dear experts,
I have in all 14 matrices which stands for gene expression divergence and 14 matrices which stands for gene sequence divergence. I have tried joining them by using the concatanation function giving
SequenceDivergence <- c(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14)
ExpressionDivergence <- c(Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8,Y9,Y10,Y11,Y12,Y13,Y14)
where X1,X2..X14 are the
2009 Nov 27
6
Learning R - View datasets
Hi All,
I am making a serious effort to try to learn R, but one hurdle I am facing is that I need to "see" the data as I walk through the examples in the packages. For instance, many examples on the web start by a command like data("wines"). How can I actually view what the dataset looks like prior to transformations and analysis? I have tried to use edit() , print, and
2000 Aug 14
5
Writing a workable function
After searching in R- Introduction, FAQ, help... I don't understand
this:
I write a function in a file (.R):
tt <- function(mc) { date()
mc<-read.csv2("machines.txt",na.strings="")
date()
}
I source it in R and I type tt(). The answer is
> tt()
[1] "Mon Aug 14 11:18:25 2000"
>
The instructions following the first "date()" are ignored. Why?
2010 Jun 04
1
sem R: singular and Could not compute QR decomposition of Hessian
Can somebody help me with the following issue (SEM in R), please:
When I run the model (includes second order models) in R, it gives me the following:
1) In sem.default(ram = ram, S = S, N = N, param.names = pars, var.names = vars, :
Could not compute QR decomposition of Hessian.
Optimization probably did not converge.
2) I have aliased parameters and NaNS
or sometimes when
2004 Jan 07
5
assign
DeaR useRs:
I would like to assign a values in an object using a loop 'for'.
This is a reduce example of my problem, my real problem is a few
complicated:
for (j in 1:10) {
x.j<-rnorm(100)
}
I want to create 10 objects as "x.1, x.2, ... , x.9, x.10" with values in
it.
I used the "assign" function but nothing happens.
Thank you very much
2006 May 10
10
Can''t Install Rails with Ruby Gem Dependencies, OS X
Hello Community:
I''m a brand new user of Ruby on Rails, and am having a great deal of
trouble compiling from source. I''m using the tutorial at
http://hivelogic.com/articles/2005/12/01/ruby_rails_lighttpd_mysql_tiger
to complete the install.
Readline and Ruby installed just fine, and the Ruby Gems appeared to.
But when I tried to sudo gem install Rails --include-dependencies,
2024 Aug 16
2
boxplot notch
Thanks Ben,
Here the reproducible example.
It works without notch=TRUE, but provides an error with notch=TURE
Error in `geom_boxplot()`:
! Problem while converting geom to grob.
? Error occurred in the 1st layer.
Caused by error in `ans[ypos] <- rep(yes, length.out = len)[ypos]`:
! replacement has length zero
Run `rlang::last_trace()` to see where the error occurred.
Warning message:
In
2012 Sep 13
6
[newbie] aggregating table() results and simplifying code with loop
Dear all,
I'm looking for primary help at aggregating table() results and at
writing a loop (if useful)
My dataset ( http://goo.gl/gEPKW ) is composed of 23k rows, each one
representing a point in the space of which we know the land cover over
10 years (column y01 to y10).
I need to analyse it with a temporal sliding window of 5 years (y01 to
y05, y02 to y06 and so forth)
For each period
2024 Aug 16
1
boxplot notch
I don't see anything obviously wrong here. There may be something
subtle, but we probably won't be able to help without a reproducible
example ...
On 2024-08-16 9:24 a.m., SIBYLLE ST?CKLI via R-help wrote:
> Dear community
>
>
>
> I tried the following code using geom_boxplot() and notch=TRUE. Does anyone
> know if the command ?notch=TRUE? is at the wrong place in
2024 Aug 16
1
boxplot notch
Dear community
I tried the following code using geom_boxplot() and notch=TRUE. Does anyone
know if the command ?notch=TRUE? is at the wrong place in my special code
construct?
Without notch=TRUE the code provides the planned ggplot.
Kind regards
Sibylle
Code:
MS1<- MS %>% filter(QI_A!="NA") %>% droplevels()
MS1$Jahr<-as.factor(MS1$Jahr)
MS1s <-