Ah ok, I see the problem! Thank you again!
--
View this message in context:
http://r.789695.n4.nabble.com/Problem-with-lapply-tp4678290p4678371.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https:/
Hi,
No problem.
Regarding your code:
#changed name from 'dataset' to "Testcor"
#Your code
firm.names=colnames(Testcor)[2:length(colnames(Testcor))]
firm.names
# [1] "PAXN" "PED" "PEDP" "PM" "PRFN" "PRWN" "ZG" "ZUBN"
#[9] "ZURN" "ZWM" "Market" #includes "Market"
Thank you! Worked perfectly!
By the way: What was wrong with my original code?
--
View this message in context:
http://r.789695.n4.nabble.com/Problem-with-lapply-tp4678290p4678305.html
Sent from the R help mailing list archive at Nabble.com.
__
R-he
Hi,
Try:
Testcor <- read.table("Testcor.txt",sep="",header=TRUE,stringsAsFactors=FALSE)
Testcor$DATE <- as.Date(Testcor$DATE)
firm.names <- colnames(Testcor)[!grepl("DATE|Market",colnames(Testcor))]
res <- sapply(firm.names, function(x) {cor.results <-
cor.test(Testcor[,x],Testcor[,"Market"],na.
4 matches
Mail list logo