Displaying 20 results from an estimated 889 matches for "var1".
Did you mean:
var
2011 Oct 12
3
labels in a boxplot
...listers,
I have a little problem with a boxplot and I hope you can help me figuring
it out.
I'll try to make up some data to illustrate the issue. Sorry, if my
procedures look naive, but these are my first steps in R. Any comments
and/or suggestions are very welcome.
let's create a vector var1:
var1 <- rnorm(100)
and 5 five logical vectors. In this case the vectors don't mean anything, I
just need 5 vectors to illustrate my problem. Each of the 5 vectors
identifies a geographic area of my interest.
med <- var1 < -0.7275
anglo <- var1 > -0.7275 & var1 < -0.09402...
2009 Feb 19
3
Multiple merge, better solution?
...ultiple files with a common
column but merge accepts only two
data.frames to merge. In the real situation, I have 26 different
data.frames with a common column. I can of course use merge many times
(see below) but what would be more sophisticated solution? For loop?
Any ideas?
DF1 <- data.frame(var1 = letters[1:5], a = rnorm(5))
DF2 <- data.frame(var1 = letters[3:7], b = rnorm(5))
DF3 <- data.frame(var1 = letters[6:10], c = rnorm(5))
DF4 <- data.frame(var1 = letters[8:12], d = rnorm(5))
g <- merge(DF1, DF2, by.x="var1", by.y="var1", all=T)
g <- merge(g, DF3,...
2004 Aug 17
5
Bug in colnames of data.frames?
Hi,
I am using R 1.9.1 on on i686 PC with SuSE Linux 9.0.
I have a data.frame, e.g.:
> myData <- data.frame( var1 = c( 1:4 ), var2 = c (5:8 ) )
If I add a new column by
> myData$var3 <- myData[ , "var1" ] + myData[ , "var2" ]
everything is fine, but if I omit the commas:
> myData$var4 <- myData[ "var1" ] + myData[ "var2" ]
the name shown above the 4th co...
2012 Sep 27
2
Generating an autocorrelated binary variable
....
Below you can see the R code (I use for simplicity a diagonal matrix in rmvnorm even if it produces no correlated sample):
"sampleCop" <- function(n = 1000, rho = 0.2) {
require(splus2R)
mvrs <- rmvnorm(n + 1, mean = rep(0, 3), cov = diag(3))
pmvrs <- pnorm(mvrs, 0, 1)
var1 <- matrix(0, nrow = n + 1, ncol = 1)
var1[1] <- qbinom(pmvrs[1, 1], 1, 0.5)
if(var1[1] == 0) var1[nrow(mvrs)] <- -1
for(i in 1:(nrow(pmvrs) - 1)) {
if(pmvrs[i + 1, 1] <= rho) var1[i + 1] <- var1[i]
else var1[i + 1] <- var1[i] * (-1)
}
sample <- matrix(0, nrow = n, nco...
2008 Feb 21
4
How to get names of a list into df:s?
R users,
I have a simple lapply question.
g <- list(a=1:3, b=4:6, c=7:9)
g <- lapply(g, function(x) as.data.frame(x))
lapply(g, function(x) cbind(x, var1 = rep(names(g), each=nrow(x))[1:nrow(x)]))
I get
$a
x var1
1 1 a
2 2 a
3 3 a
$b
x var1
1 4 a
2 5 a
3 6 a
$c
x var1
1 7 a
2 8 a
3 9 a
And I would like to have
$a
x var1
1 1 a
2 2 a
3 3 a
$b
x var1
1 4 b
2 5 b
3 6 b
$c
x var1
1 7 c
2...
2012 Apr 12
4
Recode Variable
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120412/74331e9a/attachment.pl>
2009 Sep 22
3
converting a character vector to a function's input
Hi all, I have been trying to solve this problem and have had no luck so far.
I have numeric vectors VAR1, VAR2, and VAR3 which I am trying to cbind. I also have a character vector "VAR1,VAR2,VAR3". How do I manipulate this character vector such that I can input a transformed version of the character vector into cbind and have it recognize that I'm trying to refer to my numeric vectors VA...
2008 Jul 16
2
Group level frequencies
Dear List,
I have Multi-level Data
i= Indivitual Level
g= Group Level
var1= First Variable of interest
var2= Second Variable of interest
and I want to count the frequency of "var1" and "var2" on the group
level.
I found a way, but there must be a much simpler way.
data.ml <-
data.frame(i=c(1:8),g=as.factor(c(1,1,1,2,2,3,3,3)),var1=c(3,3,3,4,4,4,4...
2006 Mar 02
1
CCF and Lag questions
I am new to R and new to time series modeling.
I have a set of variables (var1, var2, var3, var4, var5) for which I have
historical yearly data.
I am trying to use this data to produce a prediction of var1, 3 years into
the future.
I have a few basic questions:
1) I am able to read in my data, and convert it to a time series format
using 'ts.'
data_ts <- ts(data...
2013 Dec 06
2
Using assign with mapply
I have a data frame whose first colum contains the names of the variables
and whose second colum contains the values to assign to them:
: kkk <- data.frame(vars=c("var1", "var2", "var3"),
vals=c(10, 20, 30), stringsAsFactors=F)
If I do
: assign(kkk$vars[1], kkk$vals[1])
it works
: var1
[1] 10
However, if I try with mapply this is what I get:
: mapply(assign, kkk$vars, kkk$vals)
var1 var2 var3...
2010 Dec 20
2
Turning a Variable into String
...to a string. I have tried
as.symbol and as.name but it doesnt work for what I'd like to do
Essentially, I'd like to feed the function below with two variables. This
works fine in the bit working out number of elements in each variable.
In the print(sprintf("OK with %s and %s\n", var1, var2)) line I would like
var1 and var2 to be magically substituted with a string containing the name
of var1 and name of var2.
Thanks in advance
Paolo
haveSameLength <- function(var1, var2) {
if (length(var1)==length(var2))
{
print(sprintf("OK with %s and %s\n", var1, var2...
2010 Apr 12
2
Interpreting factor*numeric interaction coefficients
...ous variable. These
two predictor variables are believed to interact.
An example of such a model follows at the bottom of this message, but here
is a section of its summary table:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.220186 0.539475 2.262 0.0237 *
var1 0.028182 0.050850 0.554 0.5794
cat2 -0.112454 0.781137 -0.144 0.8855
cat3 0.339589 0.672828 0.505 0.6138
var1:cat2 0.007091 0.068072 0.104 0.9170
var1:cat3 -0.027248 0.064468 -0.423 0.6725
I am having t...
2006 Oct 23
1
Lmer, heteroscedasticity and permutation, need help please
Hi everybody,
I'm trying to analyse a set of data with a non-normal response, 2 fixed
effects and 1 nested random effect with strong heteroscedasticity in the
model.
I planned to use the function lmer : lmer(resp~var1*var2 + (1|rand)) and
then use permutations based on the t-statistic given by lmer to get
p-values.
1/ Is it a correct way to obtain p-values for my variables ? (see below)
2/ I read somewhere that lme is more adequate when heteroscedasticity is
strong. Do I have to use lme instead of lmer ?
3...
2014 Apr 11
6
crear variable en base a nombre de columnas que tienen un 1
Buenos días.
Hoy ando un poco (o bastante) espeso y no doy con la tecla de una cosa
que seguro que es muy simple..
Pongo un ejemplo.
var1 <- c(rep(0,3),rep(1,2))
var2 <- c(rep(1,2),0,0,1)
var3 <- c(rep(1,2),rep(0,3))
var4 <- c(rep(1,2),rep(0,3))
datos <- data.frame(fila=1:5,var1, var2, var3, var4)
datos
datos
fila var1 var2 var3 var4
1 1 0 1 1 1
2 2 0 1 1 1
3 3 0 0 0 0
4...
2014 Aug 21
2
pregunta
Buenas noches Javier y José,
Estoy en contra de usar attach(), asi que propongo la siguiente alternativa
con with():
# paquete
require(epicalc)
# los argumentos en ... pasan de epicalc:::cc
# ver ?cc para mas informacion
foo <- function(var1, var2, var3, ...){
or1 <- cc(var1, var2, ...)
or2 <- cc(var1, var3, ...)
list(or1 = or1, or2 = or2)
}
# datos
x <- read.csv("~/Downloads/OR.csv")
head(x)
# resultados SIN graficas
with(x, foo(estado, cake, chocolate, graph = FALSE))
Saludos,
Jorge.-
2014-08-21 12:40 GMT+1...
2014 Aug 21
2
pregunta
Estimados
Estoy entrenando hacer funciones que respondan a comandos,
en esta caso en la salida gráfica se observa que dice : Exposure=var3 y
outcome=var 1
quisiéramos que se reflejan los nombres de la base de datos : var1=estado,
var2=cake, var3=chocolate
Espero haberme explicado adecuadamente
Adjunto tabla con datos
####################################
#Comando que llama a una función
rm(list=ls())
#setwd("D:/DEMO_new/demo_scripts/OR/")
#setwd("D:/Public/Documents/R/EPICALC/funciones...
2012 Dec 21
2
how to recode an ordered factor
Dear R helpers,
I'm trying to recode an ordered factor to reverse its scale, but I can't
figure out how to make it. I am using the Recode function provided by the
Car package.
I've created an ordered variable:
data$o.var1 <- ordered(data$var1, levels=c(1,2,3,4), labels =c("very
satisfied", "fairly satisfied", "not very satisfied", "not at all
satisfied"))
Now, I'd like to have a new variable ranging from 4 = Very satisfied to 1=
not at all satisfied.
I've tried wi...
2008 Mar 19
4
plot with diffrent colour and plotting symbols
Dear mailing list members,
I am a new R user, I would like to plot the follewing data
var1 <- c(1,2,1,1,2,1,2,1,2,2)
var2 <- round(rgamma(10,2,1)/0.1)*0.1
var3 <- c(0,1,0,1,0,0,0,0,1,0)
var4 <- c(1,2,2,2,1,1,1,1,1,1)
Var <- data.frame(var1,var2,var3,var4)
Var <- Var[sort(Var$var1),]
tt <- Var$var1+((runif(length(Var$var1))/6)-(0.5/6))
labelname <- c("time 1&...
2012 Jul 01
2
list to dataframe conversion-testing for identical
HI R help,
I was trying to get identical data frame from a list using two methods.
#Suppose my list is:
listdat1<-list(rnorm(10,20),rep(LETTERS[1:2],5),rep(1:5,2))
#Creating dataframe using cbind
dat1<-data.frame(do.call("cbind",listdat1))
colnames(dat1)<-c("Var1","Var2","Var3")
#Second dataframe conversion
dat2<-data.frame(Var1=listdat1[[1]],Var2=listdat1[[2]],Var3=listdat1[[3]])
#Structure is different in two datasets
?>str(dat1)
'data.frame':??? 10 obs. of? 3 variables:
?$ Var1: Factor w/ 10 levels "18.615332...
2017 May 15
6
[IR question] Switching on pointers
...ants. I tried to use a
`switch` instruction but I encountered several problems.
The "ideal switch" I'd like to have would look something like this
(with way more cases):
; ModuleID = 'module'
source_filename = "module"
@var0 = global i32 0
@var1 = global i32 0
define i32 @func(i32*) {
entry:
switch i32* %0, label %unreachable [
i32* @var0, label %var0
i32* @var1, label %var1
]
var0: ; preds = %entry
br label %post
var1:...