Displaying 20 results from an estimated 300 matches similar to: "Data"
2011 Nov 11
1
Formula variable help
I have an R script with the following applicable lines:
xshort <- window(s, start=st, end=ed)
. . .
xshort <- ts(xshort, frequency=1, start=1)
. . .
m1 <- m2 <- m3 <- m4 <- m5 <- m6 <- NULL
m1 <- tslm(xshort ~ trend)
I get an error:
Error in get(dataname) : object 'xshort' not found
When I do traceback() I get:
3: get(dataname)
2: tslm(xshort ~
2000 May 02
2
Variable names in model formula
At 10:37 PM 5/1/00 -0400, E. S. Venkatraman wrote:
>I have the following problem. I have survival data (time, status) along
>with several covariates (X1, X2,..., Xn). I want to fit a Cox model for
>each of the covariate (univariately) and obtain the fitted probability of
>survival at a fixed time point t0 and covariate value Xi0. I tried to do
>this in a for loop where the index
2009 Oct 08
3
error message - unexpected input
I have been using R the past couple of years to run models on data we
are collecting. I recently got a new computer and updated to a new
version of R (2.60 -> 2.90). Since the update, I cannot get my syntax to
run. I have tried copying the file it is looking for into many different
directories to try and run it. In the last version, I found that it was
easiest if the file was copied into the R
2010 Jul 27
6
Eval() or parse() do not work inside function
I am writing a function where the arguments are names of objects or variable
names in a data frame. To convert the strings to the objects I am using
eval(parse(text=name)):
f.graph.two.vbs<-function(dataname,v1){
val<-paste(dataname,v1,sep="$")
val<-eval(parse(text=val))
val
}
However running this returns an error:
2017 Dec 04
0
Dynamic reference, right-hand side of function
The generic rule is that R is not a macro language, so looping of names of things gets awkward. It is usually easier to use compound objects like lists and iterate over them. E.g.
datanames <- paste0("aa_", 2000:2007)
datalist <- lapply(datanames, get)
names(datalist) <- datanames
col1 <- lapply(datalist, "[[", 1)
colnum <- lapply(col1, as.numeric)
(The 2nd
2017 Dec 04
3
Dynamic reference, right-hand side of function
Hi R-users!
Being new to R, and a fairly advanced Stata-user, I guess part of my problem is that my mindset (and probably my language as well) is wrong. Anyway, I have what I guess is a rather simple problem, that I now without success spent days trying to solve.
I have a bunch of datasets imported from Stata that is labelled aa_2000 aa_2001 aa_2002, etc. Each dataset is imported as a matrix, and
2017 Dec 04
3
Dynamic reference, right-hand side of function
Hi!
Thanks for the replies!
I understand people more accustomed to R doesn't like looping much, and that thinking about loops is something I do since I worked with Stata a lot. The syntax from Peter Dalgaard was really clever, and I learned a lot from it, even though it didn't solve my problem (I guess it wasn't very well explained). My problem was basically that I have a data matrix
2017 Dec 04
0
Dynamic reference, right-hand side of function
Um, if you insist on doing it that way, at least use
assign(varname, as.vector(get(varname)))
-pd
> On 4 Dec 2017, at 22:46 , Love Bohman <love.bohman at sociology.su.se> wrote:
>
> Hi!
> Thanks for the replies!
> I understand people more accustomed to R doesn't like looping much, and that thinking about loops is something I do since I worked with Stata a lot. The
2006 Jul 13
1
writeForeignSAS and potential extensions
Dear R-devel,
I've made some potential extensions to writeForeignSAS
in 'foreign' that I wanted to pass along if anyone is
interested. I've attached the diff -u output against
the version found in foreign_0.8-15 and an .R file
with my changes. (In this .R file, the function is named
writeForeignSAS7 to simplify testing/comparisons.)
I've tried to alter the current
2005 Feb 26
3
averaging within columns
I have a dataframe with names in the first column and wait times
between decisions in the second column. Since individuals make
multiple decisions, I want the average for each individual. For
example, the data might look like this
name wtime
jo 1
jo 2
jo 1
jo 3
tim 3
tim 2
tim 2
ro 1
ro 2
etc.
I'm hoping there is something like
mean(dataname$wtime[name])
which will just
2017 Dec 04
2
Dynamic reference, right-hand side of function
:-)
I don't insist on anything, I'm just struggling to learn a new language and partly a new way of thinking, and I really appreciate the corrections. I hope I someday will be able to handle lists in R as easy as I handle loops in Stata...
Thanks again!
Love
-----Ursprungligt meddelande-----
Fr?n: peter dalgaard [mailto:pdalgd at gmail.com]
Skickat: den 4 december 2017 23:09
Till:
2006 Mar 28
0
Help with the code
library(survival) library(boot) data=NULL lambda=NULL result=NULL pat=rep(1:102,each=1) trt=rep(c(1,0),51) status=rep(1,102) site=rep(1:51, each=2) nr.datasets=100 seed=2006 beta=log(1/2) for (i in 1:51) { lambda[i]=1+((3-1)/50)*(i-1)} lambda1=rep(lambda, each=2) dummy=rep(c(exp(beta),1),51) elf=lambda1*dummy r=70 #the number of bootstrap replicates
2017 Dec 04
0
Dynamic reference, right-hand side of function
Loops are not evil, and no-one in this thread said they are. But I
believe your failure to provide a reproducible example is creating
confusion, since you may be using words that mean one thing to you and
something else to the readers here.
################################
# A reproducible example includes a tiny set of sample data
# Since we cannot reproducibly refer to filenames (your
2000 Feb 28
1
Parser Bug Somewhere.... (PR#460)
Full_Name: John P Cavanaugh
Version: .99
OS: linux
Submission from: (NULL) (24.116.10.99)
dataset$ema12 <- EMA (dataset$Close,12)
dataset$ema26 <- EMA (dataset$Close,26)
dataset$MACD_fast <- dataset$ema26 - dataset$ema12
dataset$MACD_slow <- EMA(dataset$MACD_fast,9)
dataset$MACD_hist <- dataset$MACD_fast - dataset$MACD_slow # This line doesnt
work!!!
But... if I does work if I
2003 Apr 07
1
Segmentation error
Hello,
I'm using library(spatstat) and trying to use ppp on my dataset. I get a segmentation error when I try to run it. Any suggestions? Code below ...
Thanks,
Suzanne
---------------------------------------
dat <- read.delim(file="trees_R2.csv", sep=",", header=1)
P16 <- (dat$Plot == "P1") | (dat$Plot == "P2") | (dat$Plot == "P3")
2005 Jun 01
1
A problem on sink() and format,suggestions appreciated
Dear R users
I get a weired problem when use sink:
since the data set pretty big, I sink intermediate result for further
use,following
lines are consistently used when write data
###########################
sink("dataname.txt")
data
sink()
##########################
at first couples of run, all 10 variables are wrote to a file in following
format:
V1 V2 ....... V10
1
2009 Jan 16
1
bootstrap validation of LR error message
when i try to validate my logistic regression model:
fit<-glm(y~x,binomial,data=dataname,x=TRUE,y=TRUE)
validate(fit,method="boot",B=150,...)
i get the following error message:
Error in UseMethod("validate") : no applicable method for "validate"
any insight would be appreciated. many thanks!
--
View this message in context:
2010 Oct 20
1
Problem exporting data using write.foreign
My question is about the write.foreign() command in the foreign
package. I use a command like the following to try and output data
and a code file to read my data into SAS.
write.foreign(data.frame.object, datafile="filepath",
codefile="filepath", package="SAS", dataname="myData")
With my data set, it gives the following error:
Error in
2006 Dec 20
1
R Version Problem in using write.foreign+SAS
Hi experts,
I have a problem in Write.foreign command (SAS).
I have a data frame called d.
>d
Datetime
2006-12-01 00:00:00
2006-12-01 00:10:00
2006-12-01 00:20:00
2006-12-01 00:30:00
2006-12-01 00:40:00
>class(d$Datetime)
[1] "POSIXt" "POSIXct"
Then I tried with,
write.foreign(d,"Z:\\try_i.sas7bdat"," Z:\\try_i.sas
2017 Dec 05
0
Dynamic reference, right-hand side of function
By the way, R 'vectors' are not the equivalents of mathematical 'vectors'.
In R, a vector is something that can have arbitrary length and which has
no 'attributes', other than perhaps element names. Vectors can be numeric,
character,
complex, lists, etc. Functions, names, and NULL are not vectors. In my
opinion,
the typical data scientist will rarely find the R vector