Re: [R] get is.na & !is.na count of various combinations of columns
Hi, I just noticed that you also have all is.na() or !is.na() subsets. To do that: mydatatest <- structure(list(CaseID = structure(1:8, .Label = c("1605928", "1605943", "1605945", "1605947", "1605949", "1605951", "1605952", "1605953"), class = "factor"), Structure = structure(c(1L, 1L, 3L, 2L, 2L, 3L, 3L, 4L), .Label = c("corp", "LLC", "prop", "LAC" ), class = "factor"), Poster = c(1, 1, 1, NA, NA, 1, 1, NA), Records = c(1, 1, 1, 1, 1, NA, 1, NA), MWBW = c(NA, NA, 495.1, NA, NA, NA, 425, NA), OT = c(NA, NA, NA, NA, 411.25, NA, 432.5, NA), CL = c(NA, NA, NA, 13.52, NA, NA, 14.72, NA)), .Names = c("CaseID", "Structure", "Poster", "Records", "MWBW", "OT", "CL"), row.names = c(NA, 8L), class = "data.frame") vec1 <- names(mydatatest)[-(1:2)] res <- lapply(c(0,seq(length(vec1))),function(i) {x1 <- as.data.frame(combn(vec1,i),stringsAsFactors=FALSE); lapply(x1, function(x) {indx <- vec1 %in% x; nisna <- if(length(vec1[!indx]) > 0 ) paste(paste0("!is.na","(", vec1[!indx],")"),collapse=" & ");isna <- if(length(vec1[indx]) > 0 ) paste(paste0("is.na","(", vec1[indx],")"),collapse= " & "); nisna_isna <- gsub("^ & | & $","", paste(nisna, isna, sep= " & ")); subset(mydatatest, eval(parse(text=nisna_isna)))})}) names1 <- unlist(lapply(c(0,seq(length(vec1))),function(i) {x1 <- as.data.frame(combn(vec1,i),stringsAsFactors=FALSE); unlist(lapply(x1, function(x) {indx <- vec1 %in% x; nisna <- if(length(vec1[!indx]) > 0 ) paste(paste0("!is.na","(", vec1[!indx],")"),collapse=" & ");isna <- if(length(vec1[indx]) > 0 ) paste(paste0("is.na","(", vec1[indx],")"),collapse= " & "); nisna_isna <- gsub("^ & | & $","", paste(nisna, isna, sep= " & "))}))}),use.names=FALSE) res1 <- unlist(res,recursive=FALSE) names(res1) <- names1 res2 <- res1[sapply(res1,nrow)!=0] A.K. On Wednesday, March 19, 2014 12:59 AM, arun wrote: If you want to identify the combination of columns: names1 <- unlist(lapply(seq(length(vec1)-1),function(i) {x1 <- as.data.frame(combn(vec1,i),stringsAsFactors=FALSE); unlist(lapply(x1, function(x) {indx <- vec1 %in% x; paste(paste(paste0("!is.na","(", vec1[!indx],")"),collapse=" & "), paste(paste0("is.na","(", vec1[indx],")"),collapse= " & "), sep= " & ") }))}),use.names=FALSE) res1 <- unlist(res,recursive=FALSE) names(res1) <- names1 res1 length(res1) #[1] 30 res1[30] #$`!is.na(Poster) & is.na(Records) & is.na(MWBW) & is.na(OT) & is.na(CL)` # CaseID Structure Poster Records MWBW OT CL #6 1605951 prop 1 NA NA NA NA res2 <- res1[sapply(res1,nrow)!=0] res2[4] #$`!is.na(Poster) & !is.na(Records) & is.na(MWBW) & is.na(OT) & is.na(CL)` # CaseID Structure Poster Records MWBW OT CL #1 1605928 corp 1 1 NA NA NA #2 1605943 corp 1 1 NA NA NA Hope this helps. A.K. On , arun wrote: Hi, May be this helps: res <- lapply(seq(length(vec1)-1),function(i) {x1 <- as.data.frame(combn(vec1,i),stringsAsFactors=FALSE); lapply(x1, function(x) {indx <- vec1 %in% x; nisna <- paste(paste0("!is.na","(", vec1[!indx],")"),collapse=" & ");isna <- paste(paste0("is.na","(", vec1[indx],")"),collapse= " & ");subset(mydatatest, eval(parse(text=nisna)) & eval(parse(text=isna)))})}) A.K. On Tuesday, March 18, 2014 11:45 PM, bcrombie wrote: I'm trying to count the number of combinations of columns containing data & not containing data as described below. I"m not sure how to do this in R and need some help. #get TRUE/FALSE count of various combinations of columns per CaseID or per Structure mydatatest <- data.frame (CaseID = c("1605928", "1605943", "1605945", "1605947", "1605949", "1605951"), Structure = c("corp", "corp", "prop", "LLC", "LLC", "prop"), Poster = c(1, 1, 1, NA, NA, 1), Records = c(1, 1, 1, 1, 1, NA), MWBW = c(NA, NA, 495.10, NA, NA, NA), OT = c(NA, NA, NA, NA, 411.25, NA), CL = c(NA, NA, NA, 13.52, NA, NA)) combo1 <- subset(mydatatest, !is.na(Poster & Records & MWBW & OT & CL)) combo2 <- subset(mydatatest, !is.na(Poster & Records & MWBW & OT) & is.na(CL)) combo3 <- subset(mydatatest, !is.na(Poster & Records & MWBW) & is.na(OT & CL)) combo4 <- subset(mydatatest, !is.na(Poster & Records) & is.na(MWBW & OT & CL)) combo5 <- subset(mydatatest, !is.na(Poster) & is.na(Records & MWBW & OT & CL)) combo6 <- subset(mydatatest, !is.na(Records) & is.na(Poster & MWBW & OT & CL)) combo7 <- subset(mydatatest, !is.na(MWBW) & is.na(Poster & Records & OT & CL)) combo8 <- subset(mydatatest, !is.na(OT) & is.na(Poster & Records & MWBW & CL)) combo9 <- subset(mydatatest, !is.na(CL) & is.na(Poster & Records & MWBW & OT)) etc. -- View this message in context: http://r.789695.n4.nabble.com/get-is-na-is-na-count-of-various-combinations-of-columns-tp4687084.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https:
Re: [R] get is.na & !is.na count of various combinations of columns
If you want to identify the combination of columns: names1 <- unlist(lapply(seq(length(vec1)-1),function(i) {x1 <- as.data.frame(combn(vec1,i),stringsAsFactors=FALSE); unlist(lapply(x1, function(x) {indx <- vec1 %in% x; paste(paste(paste0("!is.na","(", vec1[!indx],")"),collapse=" & "), paste(paste0("is.na","(", vec1[indx],")"),collapse= " & "), sep= " & ") }))}),use.names=FALSE) res1 <- unlist(res,recursive=FALSE) names(res1) <- names1 res1 length(res1) #[1] 30 res1[30] #$`!is.na(Poster) & is.na(Records) & is.na(MWBW) & is.na(OT) & is.na(CL)` # CaseID Structure Poster Records MWBW OT CL #6 1605951 prop 1 NA NA NA NA res2 <- res1[sapply(res1,nrow)!=0] res2[4] #$`!is.na(Poster) & !is.na(Records) & is.na(MWBW) & is.na(OT) & is.na(CL)` # CaseID Structure Poster Records MWBW OT CL #1 1605928 corp 1 1 NA NA NA #2 1605943 corp 1 1 NA NA NA Hope this helps. A.K. On , arun wrote: Hi, May be this helps: res <- lapply(seq(length(vec1)-1),function(i) {x1 <- as.data.frame(combn(vec1,i),stringsAsFactors=FALSE); lapply(x1, function(x) {indx <- vec1 %in% x; nisna <- paste(paste0("!is.na","(", vec1[!indx],")"),collapse=" & ");isna <- paste(paste0("is.na","(", vec1[indx],")"),collapse= " & ");subset(mydatatest, eval(parse(text=nisna)) & eval(parse(text=isna)))})}) A.K. On Tuesday, March 18, 2014 11:45 PM, bcrombie wrote: I'm trying to count the number of combinations of columns containing data & not containing data as described below. I"m not sure how to do this in R and need some help. #get TRUE/FALSE count of various combinations of columns per CaseID or per Structure mydatatest <- data.frame (CaseID = c("1605928", "1605943", "1605945", "1605947", "1605949", "1605951"), Structure = c("corp", "corp", "prop", "LLC", "LLC", "prop"), Poster = c(1, 1, 1, NA, NA, 1), Records = c(1, 1, 1, 1, 1, NA), MWBW = c(NA, NA, 495.10, NA, NA, NA), OT = c(NA, NA, NA, NA, 411.25, NA), CL = c(NA, NA, NA, 13.52, NA, NA)) combo1 <- subset(mydatatest, !is.na(Poster & Records & MWBW & OT & CL)) combo2 <- subset(mydatatest, !is.na(Poster & Records & MWBW & OT) & is.na(CL)) combo3 <- subset(mydatatest, !is.na(Poster & Records & MWBW) & is.na(OT & CL)) combo4 <- subset(mydatatest, !is.na(Poster & Records) & is.na(MWBW & OT & CL)) combo5 <- subset(mydatatest, !is.na(Poster) & is.na(Records & MWBW & OT & CL)) combo6 <- subset(mydatatest, !is.na(Records) & is.na(Poster & MWBW & OT & CL)) combo7 <- subset(mydatatest, !is.na(MWBW) & is.na(Poster & Records & OT & CL)) combo8 <- subset(mydatatest, !is.na(OT) & is.na(Poster & Records & MWBW & CL)) combo9 <- subset(mydatatest, !is.na(CL) & is.na(Poster & Records & MWBW & OT)) etc. -- View this message in context: http://r.789695.n4.nabble.com/get-is-na-is-na-count-of-various-combinations-of-columns-tp4687084.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] get is.na & !is.na count of various combinations of columns
Hi, May be this helps: res <- lapply(seq(length(vec1)-1),function(i) {x1 <- as.data.frame(combn(vec1,i),stringsAsFactors=FALSE); lapply(x1, function(x) {indx <- vec1 %in% x; nisna <- paste(paste0("!is.na","(", vec1[!indx],")"),collapse=" & ");isna <- paste(paste0("is.na","(", vec1[indx],")"),collapse= " & ");subset(mydatatest, eval(parse(text=nisna)) & eval(parse(text=isna)))})}) A.K. On Tuesday, March 18, 2014 11:45 PM, bcrombie wrote: I'm trying to count the number of combinations of columns containing data & not containing data as described below. I"m not sure how to do this in R and need some help. #get TRUE/FALSE count of various combinations of columns per CaseID or per Structure mydatatest <- data.frame (CaseID = c("1605928", "1605943", "1605945", "1605947", "1605949", "1605951"), Structure = c("corp", "corp", "prop", "LLC", "LLC", "prop"), Poster = c(1, 1, 1, NA, NA, 1), Records = c(1, 1, 1, 1, 1, NA), MWBW = c(NA, NA, 495.10, NA, NA, NA), OT = c(NA, NA, NA, NA, 411.25, NA), CL = c(NA, NA, NA, 13.52, NA, NA)) combo1 <- subset(mydatatest, !is.na(Poster & Records & MWBW & OT & CL)) combo2 <- subset(mydatatest, !is.na(Poster & Records & MWBW & OT) & is.na(CL)) combo3 <- subset(mydatatest, !is.na(Poster & Records & MWBW) & is.na(OT & CL)) combo4 <- subset(mydatatest, !is.na(Poster & Records) & is.na(MWBW & OT & CL)) combo5 <- subset(mydatatest, !is.na(Poster) & is.na(Records & MWBW & OT & CL)) combo6 <- subset(mydatatest, !is.na(Records) & is.na(Poster & MWBW & OT & CL)) combo7 <- subset(mydatatest, !is.na(MWBW) & is.na(Poster & Records & OT & CL)) combo8 <- subset(mydatatest, !is.na(OT) & is.na(Poster & Records & MWBW & CL)) combo9 <- subset(mydatatest, !is.na(CL) & is.na(Poster & Records & MWBW & OT)) etc. -- View this message in context: http://r.789695.n4.nabble.com/get-is-na-is-na-count-of-various-combinations-of-columns-tp4687084.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Data file verification protocol
Hi R users, This isnt a R-specific issue, per-se, but I thought that this list would have some helpful input on this topic. First, a bit of background. I am working on a project which is interested in following approx 1000 students each semester, and collects about 15 different measurements about each student. These are both numeric and text, for example grades in a course, race, gender, etc. I am looking for a verification protocol which can look at a data file and see if it has been modified. Ideally, this should be something that I can check the file with to see if the file has been changed or corrupted and incorporate into my analysis workflow. (i.e., every time I look at my data, I can run this protocol to ensure the file hasnt changed.) Thanks! -Steve -- Steven F. Wolf Postdoctoral Research Associate CREATE for STEM Institute Michigan State University [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help with finding mean at 1 second interval
Hi, You could also try: library(plyr) ddply(mutate(sardat,sec=as.numeric(gsub(".*:(.*)\\..*$","\\1",sardat$V1))),.(sec), numcolwise(mean)) # sec V2 V3 V4 V5 V6 #1 46 15.0 3.80 11.20 4.60 17.8 #2 47 14.28571 4.428571 9.857143 3.428571 16.85714 A.K. On Tuesday, March 18, 2014 6:47 PM, Jim Lemon wrote: On 03/19/2014 02:26 AM, Satish Anupindi Rao wrote: > Hi, > ... > I would like to find the mean of the V2 to V6 columns on a per second > interval. Would anyone please be able to help me with a function and > implementation for that please? > Hi Satish, If you don't care about the location of the intervals, try this: sardat<-read.table(text="V0 V1 V2 V3 V4 V5 V6 2014-03-14 22:41:46.988804 10 2 8 3 14 2014-03-14 22:41:46.991126 13 4 9 5 15 2014-03-14 22:41:46.993506 12 4 8 3 14 2014-03-14 22:41:46.993755 19 4 15 5 22 2014-03-14 22:41:46.997780 21 5 16 7 24 2014-03-14 22:41:47.000154 18 5 13 3 21 2014-03-14 22:41:47.002376 21 5 16 6 23 2014-03-14 22:41:47.011106 12 4 8 3 14 2014-03-14 22:41:47.012691 12 4 8 3 16 2014-03-14 22:41:47.017579 11 2 9 3 12 2014-03-14 22:41:47.019463 12 5 7 3 15 2014-03-14 22:41:47.020247 14 6 8 3 17", header=TRUE,stringsAsFactors=FALSE) getsec<-function(x) { unlist(strsplit(unlist(strsplit(x,":"))[3],"[.]"))[1] } sardat$sec<-sapply(sardat$V1,getsec) sapply(sardat[,c("V2","V3","V4","V5","V6")],by,sardat$sec,mean) Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fwd: Error with glmulti
I am analyzing some data that came from demographic health surveys. The data contain information for individuals within households, that are located within clusters, that are located within survey years, that are located within countries. We are trying to find the best model from a subset of predictors, and all models must contain the random variable of household within cluster within year within country. We are running models on a server with 64GB memory and 6 CPU cores Data: Please email me if you are willing to look at this for us and I will send you the data via file transfer. It's a big file and I don't want to post it online just now. First, we tested a simple linear mixed model using the lmer package: ## Install Packages ## library(lme4) library(glmulti) ## Clear all memory/objects ## rm(list=ls()) ## Read in Data ## mydata = read.csv("kr.and.GIS.cleaned.Residents.only.csv") ### ## Try lmer model NO Interactions ## ### ptm <- proc.time() lmer.model = lmer(stunt.dhs ~ dis_ed_des+ tc_pa+ avg_clu_tc+ dist_road+ pden_lscan+ URBAN_RURA+ time.water+ wealth.index + (1|country.code.short/year/cluster/household), mydata, REML = F) print(lmer.model) proc.time() - ptm This works fine, runs in 12 minutes, and gives the following output: Linear mixed model fit by maximum likelihood ['lmerMod'] Formula: stunt.dhs ~ dis_ed_des + tc_pa + avg_clu_tc + dist_road + pden_lscan + URBAN_RURA + time.water + wealth.index + (1 | country.code.short/year/cluster/household) Data: mydata AIC BIClogLik deviance 218267.5 218420.4 -109116.7 218233.5 Random effects: GroupsNameStd.Dev. household:(cluster:(year:country.code.short)) (Intercept) 0.5584 cluster:(year:country.code.short) (Intercept) 0.3727 year:country.code.short (Intercept) 0. country.code.short(Intercept) 0.3028 Residual 1.3819 Number of obs: 59405, groups: household:(cluster:(year:country.code.short)), 40703; cluster:(year:country.code.short), 7436; year:country.code.short, 27; country.code.short, 21 Fixed Effects: (Intercept) dis_ed_destc_pa avg_clu_tc -1.324e+001.348e-07 -7.806e-04 -5.180e-04 dist_road pden_lscan URBAN_RURAU time.water -1.435e-069.003e-066.637e-02 6.097e-05 wealth.indexpoorer wealth.indexpoorest wealth.indexricher wealth.indexrichest -7.814e-02 -1.794e-011.469e-01 4.390e-01 > > proc.time() - ptm user system elapsed 727.842 13.781 741.053 Next, we tried to do model selection using the genetic algorithm of glmulti. We eventually want to include more predictors than in this current model AND we want to include interactions. This could lead to over one billion candidate models. For this reason, we want to eventually use the genetic algorithm and NOT all possible subsets. However, as a first step, we will use this smaller list of predictors and level = 1 so that no interactions are considered. First, we create the lmer wrapper and then just run the model to see how many candidate models we would have with this situation ### ## Create lmer wrapper to paste random variable to all models ## ### lmer.glmulti <- function (formula, data, random = "", ...) { lmer(paste(deparse(formula), random), data = data, REML=F, ...) } ## ## Find canditate number of models NO interactions ## ### candidate <- glmulti(stunt.dhs ~ dis_ed_des* tc_pa* avg_clu_tc* dist_road* pden_lscan* URBAN_RURA* time.water* wealth.index, data=mydata, level = 1, fitfunc = lmer.glmulti, random = "+(1|country.code.short/year/cluster/household)", method = "d") With this model, the same that we used for the lmer function, we get the following error. We also get this error if we try to run the same code but with method = "g", and confsetsize=5) Initialization... Error in factor(household:(cluster:(year:country.code.short))) :negative length vectors are not allowed If, however, we delete the household part of the random factor, the function works: candidate <- glmulti(stunt.dhs ~ dis_ed_des* tc_pa* avg_clu_tc* dist_road* pden_lscan* URBAN_RURA* time.water* wealth.index, data=mydata, level = 1, fitfunc = lmer.glmulti, random = "+(1|coun
[R] get is.na & !is.na count of various combinations of columns
I'm trying to count the number of combinations of columns containing data & not containing data as described below. I"m not sure how to do this in R and need some help. #get TRUE/FALSE count of various combinations of columns per CaseID or per Structure mydatatest <- data.frame (CaseID = c("1605928", "1605943", "1605945", "1605947", "1605949", "1605951"), Structure = c("corp", "corp", "prop", "LLC", "LLC", "prop"), Poster = c(1, 1, 1, NA, NA, 1), Records = c(1, 1, 1, 1, 1, NA), MWBW = c(NA, NA, 495.10, NA, NA, NA), OT = c(NA, NA, NA, NA, 411.25, NA), CL = c(NA, NA, NA, 13.52, NA, NA)) combo1 <- subset(mydatatest, !is.na(Poster & Records & MWBW & OT & CL)) combo2 <- subset(mydatatest, !is.na(Poster & Records & MWBW & OT) & is.na(CL)) combo3 <- subset(mydatatest, !is.na(Poster & Records & MWBW) & is.na(OT & CL)) combo4 <- subset(mydatatest, !is.na(Poster & Records) & is.na(MWBW & OT & CL)) combo5 <- subset(mydatatest, !is.na(Poster) & is.na(Records & MWBW & OT & CL)) combo6 <- subset(mydatatest, !is.na(Records) & is.na(Poster & MWBW & OT & CL)) combo7 <- subset(mydatatest, !is.na(MWBW) & is.na(Poster & Records & OT & CL)) combo8 <- subset(mydatatest, !is.na(OT) & is.na(Poster & Records & MWBW & CL)) combo9 <- subset(mydatatest, !is.na(CL) & is.na(Poster & Records & MWBW & OT)) etc. -- View this message in context: http://r.789695.n4.nabble.com/get-is-na-is-na-count-of-various-combinations-of-columns-tp4687084.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Unable to install Rhipe package for R version 3.0.2 in ubuntu-12.04
Hello, There is no package called "Rhipe" on R CRAN Any web search engine is your friend: https://www.datadr.org/install.html Regards, Pascal On Wed, Mar 19, 2014 at 12:34 AM, karthik wrote: > Hello, > > I have ubuntu 12.04 OS with R 3.0.2 version. My problem is I am getting > message like "Rhipe packages is not available for R version 3.0.2". > > Please let me know in case you have a workaround or any solution for > installing Rhipe in R 3.0.2 (for Ubuntu). > > > Regards, > Karthik > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Unable-to-install-Rhipe-package-for-R-version-3-0-2-in-ubuntu-12-04-tp4687052.html > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Pascal Oettli Project Scientist JAMSTEC Yokohama, Japan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help with finding mean at 1 second interval
Hello, Please have a look at the "xts" package. Please don't post in HTML. Regards, Pascal On Wed, Mar 19, 2014 at 12:26 AM, Satish Anupindi Rao wrote: > Hi, > I have a zoo object with the first column as index. The columns have not been > named yet... but that I can change. It looks like this : > V2 V3 V4 V5 V6 > 2014-03-14 22:41:46.988804 10 2 8 3 14 > 2014-03-14 22:41:46.991126 13 4 9 5 15 > 2014-03-14 22:41:46.993506 12 4 8 3 14 > 2014-03-14 22:41:46.993755 19 4 15 5 22 > 2014-03-14 22:41:46.997780 21 5 16 7 24 > 2014-03-14 22:41:47.000154 18 5 13 3 21 > 2014-03-14 22:41:47.002376 21 5 16 6 23 > 2014-03-14 22:41:47.011106 12 4 8 3 14 > 2014-03-14 22:41:47.012691 12 4 8 3 16 > 2014-03-14 22:41:47.017579 11 2 9 3 12 > 2014-03-14 22:41:47.019463 12 5 7 3 15 > 2014-03-14 22:41:47.020247 14 6 8 3 17 > > I would like to find the mean of the V2 to V6 columns on a per second > interval. Would anyone please be able to help me with a function and > implementation for that please? > > Thanks so much! > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Pascal Oettli Project Scientist JAMSTEC Yokohama, Japan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help with finding mean at 1 second interval
On 03/19/2014 02:26 AM, Satish Anupindi Rao wrote: Hi, ... I would like to find the mean of the V2 to V6 columns on a per second interval. Would anyone please be able to help me with a function and implementation for that please? Hi Satish, If you don't care about the location of the intervals, try this: sardat<-read.table(text="V0 V1 V2 V3 V4 V5 V6 2014-03-14 22:41:46.988804 10 2 8 3 14 2014-03-14 22:41:46.991126 13 4 9 5 15 2014-03-14 22:41:46.993506 12 4 8 3 14 2014-03-14 22:41:46.993755 19 4 15 5 22 2014-03-14 22:41:46.997780 21 5 16 7 24 2014-03-14 22:41:47.000154 18 5 13 3 21 2014-03-14 22:41:47.002376 21 5 16 6 23 2014-03-14 22:41:47.011106 12 4 8 3 14 2014-03-14 22:41:47.012691 12 4 8 3 16 2014-03-14 22:41:47.017579 11 2 9 3 12 2014-03-14 22:41:47.019463 12 5 7 3 15 2014-03-14 22:41:47.020247 14 6 8 3 17", header=TRUE,stringsAsFactors=FALSE) getsec<-function(x) { unlist(strsplit(unlist(strsplit(x,":"))[3],"[.]"))[1] } sardat$sec<-sapply(sardat$V1,getsec) sapply(sardat[,c("V2","V3","V4","V5","V6")],by,sardat$sec,mean) Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] The lib.loc argument to library().
On 19/03/14 10:59, Prof Brian Ripley wrote: On 18/03/2014 21:41, Rolf Turner wrote: I am currently having, uh, difficulties, with the latest version of lme4, which I did not have with an elderly version that I was using previously. To check things out I installed the elderly version in a directory called "AltRlib", in my home directory. I kept the latest version (1.1-5) in a directory called "Rlib" in my home directory. I have R_LIBS set equal to "/home/rolf/Rlib" in my environment, so that "Rlib" gets searched automatically. If I start R in my home directory and issue the call library(lme4,lib.loc="/home/rolf/AltRlib") then I get the elderly version as required. If I start R in a subdirectory, say "/home/Rolf/Foo" and issue the *same command*, I get the 1.1-5 version, *NOT* as required. After some head-scratching I moved the .RData file in "Foo" to Save.RData and re-started R. ***Then*** I got the version of lme4 that I wanted. So I removed all traces of results produced by the 1.1-5 version of lme4 from Save.RData (saving them elsewhere for safekeeping), moved Save.RData back to .RData, re-started R, issued the library command, and got the unwanted 1.1-5 version!!! Can anyone explain WTF is going on? What is hanging around in .RData that causes library() to ignore the "lib.loc" argument? How can I keep library() from ignoring the "lib.loc" argument? It seems you have already loaded the namespace 'lme4' before you issue the library() call. Try loadedNamespaces() to confirm. As the help says ‘library(package)’ and ‘require(package)’ both load the package with name ‘package’ and put it on the search list. ‘require’ is designed for use inside other functions; it returns ‘FALSE’ and gives a warning (rather than an error as ‘library()’ does by default) if the package does not exist. Both functions check and update the list of currently loaded packages and do not reload a package which is already loaded. Thanks Brian. That was indeed the problem. Doing loadedNamespaces() before issuing any library() call did indeed reveal that lme4 was among the loaded namespaces. I found that issuing the command unloadNamespace("lme4") and then issuing the library() command with lib.loc specified got me the elderly version of lme4 that I wanted. So I can now carry on. It appears that the presence of "lme4 objects" of *whatever* vintage is triggering the loading of the "lme4" namespace, and the namespace is (of course?!?) that of the version that appears in one of the directories in .libPaths(). Seems obvious in retrospect. Given that one is aware that the presence of "lme4 objects" triggers the loading of the "lme4" namespace. cheers, Rolf __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] The lib.loc argument to library().
On 18/03/2014 21:41, Rolf Turner wrote: I am currently having, uh, difficulties, with the latest version of lme4, which I did not have with an elderly version that I was using previously. To check things out I installed the elderly version in a directory called "AltRlib", in my home directory. I kept the latest version (1.1-5) in a directory called "Rlib" in my home directory. I have R_LIBS set equal to "/home/rolf/Rlib" in my environment, so that "Rlib" gets searched automatically. If I start R in my home directory and issue the call library(lme4,lib.loc="/home/rolf/AltRlib") then I get the elderly version as required. If I start R in a subdirectory, say "/home/Rolf/Foo" and issue the *same command*, I get the 1.1-5 version, *NOT* as required. After some head-scratching I moved the .RData file in "Foo" to Save.RData and re-started R. ***Then*** I got the version of lme4 that I wanted. So I removed all traces of results produced by the 1.1-5 version of lme4 from Save.RData (saving them elsewhere for safekeeping), moved Save.RData back to .RData, re-started R, issued the library command, and got the unwanted 1.1-5 version!!! Can anyone explain WTF is going on? What is hanging around in .RData that causes library() to ignore the "lib.loc" argument? How can I keep library() from ignoring the "lib.loc" argument? It seems you have already loaded the namespace 'lme4' before you issue the library() call. Try loadedNamespaces() to confirm. As the help says ‘library(package)’ and ‘require(package)’ both load the package with name ‘package’ and put it on the search list. ‘require’ is designed for use inside other functions; it returns ‘FALSE’ and gives a warning (rather than an error as ‘library()’ does by default) if the package does not exist. Both functions check and update the list of currently loaded packages and do not reload a package which is already loaded. Thanks. cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installation of R-3.0.3
This really belongs on the R-devel list, in so far as it is an R issue at all. The most likely explanation is that you have a mismatch between your readline headers and library. That symbol needs readline >= 6.0. On 18/03/2014 18:53, Fong Chun Chan wrote: Hi, I am trying to install the newest version of R-3.0.3 from source and I've been successful in the configuration using this command: ./configure --enable-R-shlib --with-x=no --prefix=/home/fcchan/usr/local/R-3.0.3 When I run make, I run into this issue: gcc -std=gnu99 -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/pcre -I../../src/extra -I../../src/extra/xz/api -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -fopenmp -fpic -g -O2 -c Rmain.c -o Rmain.o gcc -std=gnu99 -Wl,--export-dynamic -fopenmp -L/usr/local/lib64 -o R.bin Rmain.o -L../../lib -lR -lRblas ../../lib/libR.so: undefined reference to `rl_sort_completion_matches' collect2: ld returned 1 exit status Looking around it appears to be associated with the readline library which I've successfully installed. This is my linux operating system build if it helps (I don't have admin on the machine) cat /proc/version Linux version 2.6.18-164.el5 (mockbu...@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Thu Sep 3 03:28:30 EDT 2009 Any help would be appreciated. Thanks, -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] The lib.loc argument to library().
I am currently having, uh, difficulties, with the latest version of lme4, which I did not have with an elderly version that I was using previously. To check things out I installed the elderly version in a directory called "AltRlib", in my home directory. I kept the latest version (1.1-5) in a directory called "Rlib" in my home directory. I have R_LIBS set equal to "/home/rolf/Rlib" in my environment, so that "Rlib" gets searched automatically. If I start R in my home directory and issue the call library(lme4,lib.loc="/home/rolf/AltRlib") then I get the elderly version as required. If I start R in a subdirectory, say "/home/Rolf/Foo" and issue the *same command*, I get the 1.1-5 version, *NOT* as required. After some head-scratching I moved the .RData file in "Foo" to Save.RData and re-started R. ***Then*** I got the version of lme4 that I wanted. So I removed all traces of results produced by the 1.1-5 version of lme4 from Save.RData (saving them elsewhere for safekeeping), moved Save.RData back to .RData, re-started R, issued the library command, and got the unwanted 1.1-5 version!!! Can anyone explain WTF is going on? What is hanging around in .RData that causes library() to ignore the "lib.loc" argument? How can I keep library() from ignoring the "lib.loc" argument? Thanks. cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error message
We cannot help you. You claim to have set the working directory but cannot find the file you expect to be there. Either you have failed to set the directory correctly, or the file is not where you think it is... and since we do not have access to your computer we have no way to tell you which case is true. You can, though. Use the getwd() function to confirm your working directory, and use the list.files function to confirm whether your file is there. Please follow the guidance in the Posting Guide next time you post, including using plain text email and a reproducible example. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On March 18, 2014 7:09:31 AM PDT, anisha honey wrote: >Hello >When i run this command i get the error as shown below.I also changed >my >working directory and set it where ever i want but still its >hopeless.please help me >>counts <- read.table("NewBrain.tab", header=TRUE, row.names=1) >Error in file(file, "rt") : cannot open the connection >In addition: Warning message: >In file(file, "rt") : > cannot open file 'NewBrain.tab': No such file or directory > > [[alternative HTML version deleted]] > >__ >R-help@r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] automatically replacing the third period with a break
Perfect. Thanks! On Tue, Mar 18, 2014 at 2:26 PM, Thomas Lumley wrote: > On Tue, Mar 18, 2014 at 12:43 PM, Dustin Fife wrote: > >> I've got a dataset with really long column names (e.g., >> CYJ.OSU.OAV.UJC.BUT.RDI). What I'd like to do is replace the fourth period >> with a break ("\n") so that when it plots, it will not run off the page. >> Here's what I've got so far: >> >> create fake names function >> fake.names = function(x){ >> paste0(LETTERS[sample(1:26,3)], collapse="") >> } >> create the fake names >> fake = paste0(unlist(lapply(1:6, fake.names)), collapse=".") >> >> > Backreferences > > cat( > gsub("(([[:alnum:]]+\\.){3})([[:alnum:]]+)\\.", > "\\1\\2\n", > fake > ) > ) > > That is, match three word/period sequences, match a word, match a period, > and output the first two things. > > -thomas > > -- > Thomas Lumley > Professor of Biostatistics > University of Auckland > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] RCurl: How to select options in online form and download the data
Hi, I would like to download discharge data for thousands of rivers from this website: http://ida.water.usgs.gov/ida/available_records.cfm?sn=1234 I have managed to fill in the blank spaces in the form (start and end time) using library(RCurl) url1<-"http://ida.water.usgs.gov/ida/available_records.cfm?sn=1234"; start<-"1990-10-13" end<-"2007-09-30" result <- postForm(url1, fromdate=start, todate=end) I get stuck on choosing an option on how to save the data in this piece of the page source code: Save to file Save to compressed file Display in browser I have three specific questions: How do I select option 1 or 3? How do I "click" the "Retrieve Data" button? How do I download the data? I think that downloading the data might be more feasible with option 3 (display in browser). Option 1 (Save to file) will bring up the standard dialogue asking me where on my computer to save the file. I don't know how to deal with this dialogue in R. Option 3 opens a new webpage with the URL: "http://ida.water.usgs.gov/ida/available_records_process.cfm"; (Note the river ID 1234 is not in this URL). I could save the webpage as a .txt file, but I don't know how to get to this webpage using R. In either case the RCurl option followLocation would seem helpful, but I cannot figure out how to tell R to save what is on the second webpage that the first refers to. Any help will be much appreciated. Frauke -- View this message in context: http://r.789695.n4.nabble.com/RCurl-How-to-select-options-in-online-form-and-download-the-data-tp4687062.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] automatically replacing the third period with a break
On Tue, Mar 18, 2014 at 12:43 PM, Dustin Fife wrote: > I've got a dataset with really long column names (e.g., > CYJ.OSU.OAV.UJC.BUT.RDI). What I'd like to do is replace the fourth period > with a break ("\n") so that when it plots, it will not run off the page. > Here's what I've got so far: > > create fake names function > fake.names = function(x){ > paste0(LETTERS[sample(1:26,3)], collapse="") > } > create the fake names > fake = paste0(unlist(lapply(1:6, fake.names)), collapse=".") > > Backreferences cat( gsub("(([[:alnum:]]+\\.){3})([[:alnum:]]+)\\.", "\\1\\2\n", fake ) ) That is, match three word/period sequences, match a word, match a period, and output the first two things. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] passing variables into R
#if you want to just extract the columns of dat1 using vector1, you can just use: dat1[,vector1] A.K. On Tuesday, March 18, 2014 1:13 PM, arun wrote: Hi, Not sure about your expected output. May be this helps: vector1 <- c("LA_A", "LA_B", "G_A") dat1 <- setNames(as.data.frame(matrix(1:20,ncol=4)),c(vector1,"G_Z")) lapply(vector1, function(i) with(dat1,get(i))) #or for(i in vector1){ print(with(dat1,get(i)))} A.K. Hello, I just started learning R, and have the following problem. Would like to get the specific columns one by one, but do not know how to pass variables in R A piece of code below (does not work :) ) vector <- c("LA_A", "LA_B", "G_A", "G_B", "CK_A", "CK_B", "LDH_A", "LDH_B", "AST_A", "AST_B", "CRP_A", "CRP_B", "ALT_A", "ALT_B", "CT_A", "CT_B", "BUN_A", "BUN_B", "C_A", "C_B", "T_A", "T_B") for ( i in vector ) { i <- as.name(i) dataframe$i } __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Error message
Hello When i run this command i get the error as shown below.I also changed my working directory and set it where ever i want but still its hopeless.please help me >counts <- read.table("NewBrain.tab", header=TRUE, row.names=1) Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'NewBrain.tab': No such file or directory [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Unable to install Rhipe package for R version 3.0.2 in ubuntu-12.04
Hello, I have ubuntu 12.04 OS with R 3.0.2 version. My problem is I am getting message like "Rhipe packages is not available for R version 3.0.2". Please let me know in case you have a workaround or any solution for installing Rhipe in R 3.0.2 (for Ubuntu). Regards, Karthik -- View this message in context: http://r.789695.n4.nabble.com/Unable-to-install-Rhipe-package-for-R-version-3-0-2-in-ubuntu-12-04-tp4687052.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] multicore - handling a list of return values
Hi, I was trying to gather/combine the results returned from the mclapply function. This is how I do it if only one data object is returned: #= This works fine === library(multicore) frandom1 <- function(iter,var1 = 3,var2 =2){ mat <- matrix(rnorm(var1*var2),nrow=var1,ncol=var2) return(mat) } N <- 3 ### OK temp1 <- mclapply(1:N,frandom1,mc.cores=2) result1 <- do.call(rbind,temp1) print(result1) # Now, I want to return more than one object from my function and I am not sure how best to combine the values returned. My current code is: #=== ??? = frandom2 <- function(iter,var1 = 3,var2 =2){ mat <- matrix(rnorm(var1*var2),nrow=var1,ncol=var2) vect1 <- sample(1:1000,var1) return(list(mat,vect1)) } temp2 <- mclapply(1:N,frandom2,mc.cores=2) Combining returned values result2 <- result3 <- c() for(k in 1:N){ thismat <- temp2[[k]][[1]] result2 <- rbind(result2,thismat) thisvect <- temp2[[k]][[2]] result3 <- c(result3,thisvect) } #== Is there a more elegant way of combining these values (as in the top example)? Although this works, for a large value of N ( N > 500,000), running a loop would be very expensive. Any help would be appreciated! thanks! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] nlrq-{quantreg}
Dear all, I am trying to use the nonlinear quantile regression which involves copula functions. Following the Frank copula example provided in the "quantreg" vignette I try do do the same using the Normal (Gaussian) copula. The problem is that the "nlrq" algorithm stops by giving the following error: "Error in numericDeriv(form[[3]], names(ind), env) : Missing value or an infinity produced when evaluating the model In addition: Warning message: In sqrt(1 - rho^2) : NaNs produced Error in nlrq.calc(m, ctrl, trace) : optim unable to find valid step size" I have to say that rarely (e.g. 1% of the times) the code below works, but gives me really wrong estimations for some quantiles. I suspect the convergence problem is related to the correlation parameter "rho". Is there any way I can put "lower" and "upper" parameter bounds in "nlrq" e.g. like in "nls"? Well..., by looking the ?nlrq it seems this is not possible, but I hope I am wrong :). Some example code: library(quantreg) n <- 1000 # sample size df <- 3 # degrees of freedom for the marginal distribution rho <- 0.5 # Normal copula parameter u <- runif(n) x <- sort(rt(n,df)) v <- pnorm(rho*qnorm(pt(x,df))+sqrt(1-rho^2)*qnorm(u)) y <- qnorm(v) # below I assume I know Fx is t-distributed with known df. plot(x, y, pch = ".", cex = 3,xlim=c(-4,4),ylim=c(-4,4),main="Normal copula pth quantile curves") us <- seq(0.1,0.9,0.1) for (i in 1:length(us)) { vq <- pnorm(rho*qnorm(pt(x,df))+sqrt(1-rho^2)*qnorm(us[i])) lines(x, qt(vq,df),lty=ltys[i],lwd=3,col="blue") } Dat <- NULL Dat$x <- x Dat$y <- y deltasN <- matrix(0, length(us),3) # here is my non-linear quantile model NormalModel <- function(x,rho, mu,sigma,df,tau){ z <- qt(pnorm(rho*qnorm(pt(x,df))+sqrt(1-rho^2)*qnorm(tau)),df) mu + sigma * z } for (i in 1:length(us)) { tau = us[i] fit <- nlrq(y ~ NormalModel(x,rho, mu,sigma,df=3,tau = tau), data = Dat, tau = tau, start = list(rho =0.5,mu = 0, sigma = 1), trace = TRUE) lines(x, predict(fit, newdata = x), lty = 2,col = "red") deltasN[i, ] <- coef(fit) } deltasN I am running R(3.03) on Mac OS 10.9 and quantreg(5.05) Thank you! Francesco [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help with finding mean at 1 second interval
Hi, I have a zoo object with the first column as index. The columns have not been named yet... but that I can change. It looks like this : V2 V3 V4 V5 V6 2014-03-14 22:41:46.988804 10 2 8 3 14 2014-03-14 22:41:46.991126 13 4 9 5 15 2014-03-14 22:41:46.993506 12 4 8 3 14 2014-03-14 22:41:46.993755 19 4 15 5 22 2014-03-14 22:41:46.997780 21 5 16 7 24 2014-03-14 22:41:47.000154 18 5 13 3 21 2014-03-14 22:41:47.002376 21 5 16 6 23 2014-03-14 22:41:47.011106 12 4 8 3 14 2014-03-14 22:41:47.012691 12 4 8 3 16 2014-03-14 22:41:47.017579 11 2 9 3 12 2014-03-14 22:41:47.019463 12 5 7 3 15 2014-03-14 22:41:47.020247 14 6 8 3 17 I would like to find the mean of the V2 to V6 columns on a per second interval. Would anyone please be able to help me with a function and implementation for that please? Thanks so much! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Installation of R-3.0.3
Hi, I am trying to install the newest version of R-3.0.3 from source and I've been successful in the configuration using this command: ./configure --enable-R-shlib --with-x=no --prefix=/home/fcchan/usr/local/R-3.0.3 When I run make, I run into this issue: gcc -std=gnu99 -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/pcre -I../../src/extra -I../../src/extra/xz/api -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -fopenmp -fpic -g -O2 -c Rmain.c -o Rmain.o gcc -std=gnu99 -Wl,--export-dynamic -fopenmp -L/usr/local/lib64 -o R.bin Rmain.o -L../../lib -lR -lRblas ../../lib/libR.so: undefined reference to `rl_sort_completion_matches' collect2: ld returned 1 exit status Looking around it appears to be associated with the readline library which I've successfully installed. This is my linux operating system build if it helps (I don't have admin on the machine) cat /proc/version Linux version 2.6.18-164.el5 (mockbu...@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Thu Sep 3 03:28:30 EDT 2009 Any help would be appreciated. Thanks, [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] automatically replacing the third period with a break
I've got a dataset with really long column names (e.g., CYJ.OSU.OAV.UJC.BUT.RDI). What I'd like to do is replace the fourth period with a break ("\n") so that when it plots, it will not run off the page. Here's what I've got so far: create fake names function fake.names = function(x){ paste0(LETTERS[sample(1:26,3)], collapse="") } create the fake names fake = paste0(unlist(lapply(1:6, fake.names)), collapse=".") replace fourth period with \n gsub("[[:alnum:]]\\.[[:alnum:]]+\\.[[:alnum:]]+\\.[[:alnum:]]+\\.", "[[:alnum:]]\\.[[:alnum:]]+\\.[[:alnum:]]+\\.[[:alnum:]]+\n",fake) which results in something like: "TW[[:alnum:]].[[:alnum:]]+.[[:alnum:]]+.[[:alnum:]]+\nNQJ.VSI" Any ideas on how to make it replace that? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fwd: R basic data manipulation Queries
Not exactly automatic, but if you are using Windows: 1. Open a blank spreadsheet in Excel 2. write.table(cor(nums2), file="clipboard-128", sep="\t") # In R 3. Paste the clipboard into the spreadsheet Package xlsx can write Excel format files, but does not put them directly into Excel. For the second question, as John said new_acc <- acc_mod new_acc <- names(List of names in order) replaces all of the names. It is fine if you don't have very many, but rename lets you change just a few. You need to read some introductory R manuals. Variables stored within a data.frame are not visible to R without attach(new_acc) followed by class(LocEast), or better, class(new_acc$LocEast). - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of John Kane Sent: Tuesday, March 18, 2014 11:09 AM To: Pavneet Arora; r-help@r-project.org Subject: Re: [R] Fwd: R basic data manipulation Queries In line John Kane Kingston ON Canada > -Original Message- > From: pavnee...@yahoo.co.uk > Sent: Tue, 18 Mar 2014 10:10:38 + > To: r-help@r-project.org > Subject: [R] Fwd: R basic data manipulation Queries > > > > > > > Sent from Samsung Mobile > > Original message > Subject: R basic data manipulation Queries > From: Pavneet Arora > To: pavnee...@yahoo.co.uk > CC: > > Hello Guys > > I am new in R, so please excuse the really basic questions. I have tried > reading numeral tutorials, but I am still stuck. > Question 1: > If I perform correlation on my data [cor(nums2)] or try to produce > variance matrix [var(nums2)]. The output comes in R console. Is there any > way I can make it go directly to excel somehow? Not exactly but fairly easily. Have a look at the R-site and go to the Manuals section. There is a R Import and Export manual there. > > Question 2: > Also is there any way I can permanently change the variable name in a > data frame. > I basically imported my dataset from SAS using "read.ssd" function in > library(foreign). However, this package cuts off the variable names and > only allows 8 characters! So that means I will have to rename some of my > variable names, so they make more sense as to what it is. > > part (a): > At the moment, I did the following to change the variable names, using > library(plyr). First of all, is this the most succint way of doing this? > new_acc <- rename(acc_mod,c("NAME_OF_"="weekName", "ACCIDENT"="AccSev", > "YEARMONH"="YrMonHr", > "X_1ST_ROA"="1RdCls.N", "ROAD_TYP"="RdType.N", "LOCATION"="LocEast")) > > part (b): > Secondly, I wanted to do the above, to change the name permanently - but > I don't think it worked, because when I do the following, I get: > class(LocEast) # New name of "LOCATION" > class(LOCATION) > R Output: >> class(LocEast) > Error: object 'LocEast' not found >> class(LOCATION) > [1] "numeric" > > Thanks so much!B > [[alternative HTML version deleted]] > I have never used plyr for thhis but just names(aac.mod) <- c("Newname1, "Newname2") and so on for a new name for each column in the data.frame should do it. Protect your computer files with professional cloud backup. Get PCRx Backup and upload unlimited files automatically. Learn more at http://backup.pcrx.com/mail __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fwd: R basic data manipulation Queries
In line John Kane Kingston ON Canada > -Original Message- > From: pavnee...@yahoo.co.uk > Sent: Tue, 18 Mar 2014 10:10:38 + > To: r-help@r-project.org > Subject: [R] Fwd: R basic data manipulation Queries > > > > > > > Sent from Samsung Mobile > > Original message > Subject: R basic data manipulation Queries > From: Pavneet Arora > To: pavnee...@yahoo.co.uk > CC: > > Hello Guys > > I am new in R, so please excuse the really basic questions. I have tried > reading numeral tutorials, but I am still stuck. > Question 1: > If I perform correlation on my data [cor(nums2)] or try to produce > variance matrix [var(nums2)]. The output comes in R console. Is there any > way I can make it go directly to excel somehow? Not exactly but fairly easily. Have a look at the R-site and go to the Manuals section. There is a R Import and Export manual there. > > Question 2: > Also is there any way I can permanently change the variable name in a > data frame. > I basically imported my dataset from SAS using "read.ssd" function in > library(foreign). However, this package cuts off the variable names and > only allows 8 characters! So that means I will have to rename some of my > variable names, so they make more sense as to what it is. > > part (a): > At the moment, I did the following to change the variable names, using > library(plyr). First of all, is this the most succint way of doing this? > new_acc <- rename(acc_mod,c("NAME_OF_"="weekName", "ACCIDENT"="AccSev", > "YEARMONH"="YrMonHr", > "X_1ST_ROA"="1RdCls.N", "ROAD_TYP"="RdType.N", "LOCATION"="LocEast")) > > part (b): > Secondly, I wanted to do the above, to change the name permanently - but > I don't think it worked, because when I do the following, I get: > class(LocEast) # New name of "LOCATION" > class(LOCATION) > R Output: >> class(LocEast) > Error: object 'LocEast' not found >> class(LOCATION) > [1] "numeric" > > Thanks so much!B > [[alternative HTML version deleted]] > I have never used plyr for thhis but just names(aac.mod) <- c("Newname1, "Newname2") and so on for a new name for each column in the data.frame should do it. Protect your computer files with professional cloud backup. Get PCRx Backup and upload unlimited files automatically. Learn more at http://backup.pcrx.com/mail __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Overriding predict based on newdata...
Jonathan: As David said, this is a key aspect of S4 (there are others, of course). But it can be "simulated" in S3, I think, albeit inelegantly. You merely have to extend the class of "object", the fitted object you dispatch on, and then write an appropriate method for this extended class. e.g. ## wholly untested! class(obj)<- c("mySpecial",class(obj)) ## extend class of fitted object predict.mySpecial<- function(object,newdata,...){ if(inherits(newdata,"weirdClasss")){ ... ## do something } else NextMethod() ## pass through to standard predict method } ## Now this will work as desired: predict(obj) If this is obviously stupid -- or even not so obviously -- I would appreciate someone pointing it out. Best, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." H. Gilbert Welch On Tue, Mar 18, 2014 at 7:28 AM, Jonathan Greenberg wrote: > David: > > Thanks! Is it generally frowned upon (if I'm Incorporating this into > a package) to "override" a generic function like "predict", even if I > plan on making it a pass-through function (same parameters, and if the > data type doesn't match my "weird" data type, it will simply pass the > parameters through to the generic S3 "predict")? > > --j > > On Mon, Mar 17, 2014 at 4:08 AM, David Winsemius > wrote: >> S3 classes only dispatch on the basis of the first parameter class. That was >> one of the reasons for the development of S4-classed objects. You say you >> have the expectation that the object is of a class that has an ordinary >> `predict` method presumably S3 in character, so you probably need to write >> a function that will mask the existing method. You would rewrite the >> existing test for the existence of 'newdata' and the the definition of the >> new function would persist through the rest of the session and could be >> source()-ed in further sessions. >> >> -- >> David. >> >> >> On Mar 16, 2014, at 2:09 PM, Jonathan Greenberg wrote: >> >>> R-helpers: >>> >>> I'm having some trouble with this one -- I figure because I'm a bit of >>> a noob with S3 classes... Here's my challenge: I want to write a >>> custom predict statement that is triggered based on the presence and >>> class of a *newdata* parameter (not the "object" parameter). The >>> reason is I am trying to write a custom function based on an oddly >>> formatted dataset that has been assigned an R class. If the predict >>> function "detects" it (class(newdata) == "myweirdformat") it does a >>> conversion of the newdata to what most predict statements expect (e.g. >>> a dataframe) and then passes the converted dataset along to the >>> generic predict statement. If newdata is missing or is not of the odd >>> class it should just pass everything along to the generic predict as >>> usual. >>> >>> What would be the best way to approach this problem? Since (my >>> understanding) is that predict is dispatched based on the object >>> parameter, this is causing me confusion -- my object should still >>> remain the model, I'm just allowing a new data type to be fed into the >>> predict model(s). >>> >>> Cheers! >>> >>> --j >>> >>> -- >>> Jonathan A. Greenberg, PhD >>> Assistant Professor >>> Global Environmental Analysis and Remote Sensing (GEARS) Laboratory >>> Department of Geography and Geographic Information Science >>> University of Illinois at Urbana-Champaign >>> 259 Computing Applications Building, MC-150 >>> 605 East Springfield Avenue >>> Champaign, IL 61820-6371 >>> Phone: 217-300-1924 >>> http://www.geog.illinois.edu/~jgrn/ >>> AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 >>> >>> __ >>> R-help@r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >> >> David Winsemius >> Alameda, CA, USA >> > > > > -- > Jonathan A. Greenberg, PhD > Assistant Professor > Global Environmental Analysis and Remote Sensing (GEARS) Laboratory > Department of Geography and Geographic Information Science > University of Illinois at Urbana-Champaign > 259 Computing Applications Building, MC-150 > 605 East Springfield Avenue > Champaign, IL 61820-6371 > Phone: 217-300-1924 > http://www.geog.illinois.edu/~jgrn/ > AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-pr
Re: [R] Overriding predict based on newdata...
On Mon, Mar 17, 2014 at 4:08 AM, David Winsemius wrote: > S3 classes only dispatch on the basis of the first parameter class. A minor distinction: S3 classes only dispatch on the basis on *one* of the parameters. The person who writes the generic gets to choose, and for predict() it is the first parameter, but it doesn't have to be for other generics. In model-fitting functions you often have formula= as the first argument and data= as the second, and it makes much more sense to dispatch on data= than on formula=. The first well-known example is probably MASS::loglm, used in "S Programming" to illustrate this issue but most of the methods in my survey package also dispatch based on the second argument. > That was one of the reasons for the development of S4-classed objects. You > say you have the expectation that the object is of a class that has an > ordinary `predict` method presumably S3 in character, so you probably need > to write a function that will mask the existing method. Or write an S4 method for predict and use setGeneric(). That's also not perfect: if everyone did it there would be lots of competing S4 generics with the same name, and too many people would have to understand how they are scoped. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Overriding predict based on newdata...
David: Thanks! Is it generally frowned upon (if I'm Incorporating this into a package) to "override" a generic function like "predict", even if I plan on making it a pass-through function (same parameters, and if the data type doesn't match my "weird" data type, it will simply pass the parameters through to the generic S3 "predict")? --j On Mon, Mar 17, 2014 at 4:08 AM, David Winsemius wrote: > S3 classes only dispatch on the basis of the first parameter class. That was > one of the reasons for the development of S4-classed objects. You say you > have the expectation that the object is of a class that has an ordinary > `predict` method presumably S3 in character, so you probably need to write a > function that will mask the existing method. You would rewrite the existing > test for the existence of 'newdata' and the the definition of the new > function would persist through the rest of the session and could be > source()-ed in further sessions. > > -- > David. > > > On Mar 16, 2014, at 2:09 PM, Jonathan Greenberg wrote: > >> R-helpers: >> >> I'm having some trouble with this one -- I figure because I'm a bit of >> a noob with S3 classes... Here's my challenge: I want to write a >> custom predict statement that is triggered based on the presence and >> class of a *newdata* parameter (not the "object" parameter). The >> reason is I am trying to write a custom function based on an oddly >> formatted dataset that has been assigned an R class. If the predict >> function "detects" it (class(newdata) == "myweirdformat") it does a >> conversion of the newdata to what most predict statements expect (e.g. >> a dataframe) and then passes the converted dataset along to the >> generic predict statement. If newdata is missing or is not of the odd >> class it should just pass everything along to the generic predict as >> usual. >> >> What would be the best way to approach this problem? Since (my >> understanding) is that predict is dispatched based on the object >> parameter, this is causing me confusion -- my object should still >> remain the model, I'm just allowing a new data type to be fed into the >> predict model(s). >> >> Cheers! >> >> --j >> >> -- >> Jonathan A. Greenberg, PhD >> Assistant Professor >> Global Environmental Analysis and Remote Sensing (GEARS) Laboratory >> Department of Geography and Geographic Information Science >> University of Illinois at Urbana-Champaign >> 259 Computing Applications Building, MC-150 >> 605 East Springfield Avenue >> Champaign, IL 61820-6371 >> Phone: 217-300-1924 >> http://www.geog.illinois.edu/~jgrn/ >> AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > David Winsemius > Alameda, CA, USA > -- Jonathan A. Greenberg, PhD Assistant Professor Global Environmental Analysis and Remote Sensing (GEARS) Laboratory Department of Geography and Geographic Information Science University of Illinois at Urbana-Champaign 259 Computing Applications Building, MC-150 605 East Springfield Avenue Champaign, IL 61820-6371 Phone: 217-300-1924 http://www.geog.illinois.edu/~jgrn/ AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] open unknown file format in R
Hello, http://www.chikyu.ac.jp/precip/products/index.html HTH, Pascal On Tue, Mar 18, 2014 at 10:09 PM, eliza botto wrote: > Thankyou very much indeed.My limited knowledge of R is forcing me to ask you > that how did you know the following information (AphroJP, 123°E-146°E, > 24°N-46°N, resolution 0.05x0.05 i.e. 440 rows x 460columns)? > > Thanks, > > Eliza > > >> From: kri...@ymail.com >> Date: Tue, 18 Mar 2014 21:39:58 +0900 > >> Subject: Re: [R] open unknown file format in R >> To: eliza_bo...@hotmail.com >> CC: r-help@r-project.org >> >> Hello, >> >> It is not around the world. It is only for Japan (AphroJP, >> 123°E-146°E, 24°N-46°N, resolution 0.05x0.05 i.e. 440 rows x 460 >> columns). You can store in a Raster* object then extract the grid >> points you need, with the coordinates. >> >> HTH >> Pascal >> >> >> >> On Tue, Mar 18, 2014 at 9:21 PM, eliza botto >> wrote: >> > Hi Pascal, >> > >> > Your code worked out perfectly but I have one question though. You wrote >> > that you did not use stations. What if I want to read stations as i am >> > only >> > >> > interest in a part of data. I need it because the file has data for >> > 202400 >> > stations around the globe and I am only interest in data of 22 stations. >> > >> > Thankyou very much in advance, >> > >> > Eliza >> > >> > >> >> From: kri...@ymail.com >> >> Date: Tue, 18 Mar 2014 08:51:01 +0900 >> >> Subject: Re: [R] open unknown file format in R >> >> To: eliza_bo...@hotmail.com >> >> CC: r-help@r-project.org >> >> >> >> Hello, >> >> >> >> It is in binary format. I didn't use stations. But to read the gridded >> >> format, I used: >> >> >> >> > readBin(fid, numeric(), n=1e8, size=4, signed=TRUE, endian='little') >> >> >> >> where file is the connection created with file() >> >> >> >> Hope this helps, >> >> Pascal >> >> >> >> >> >> >> >> >> >> On Tue, Mar 18, 2014 at 4:06 AM, eliza botto >> >> wrote: >> >> > Dear R-Family, >> >> > I have just downloaded a massive data file from internet >> >> > (AphroJP_62STN_V1005.1900.gz). Apparently, the file is compressed >> >> > with .gz. >> >> > When I uncompressed >> >> > it, the file was saved in the name (AphroJP_62STN_V1005.1900) of >> >> > unknown >> >> > format. How can I open it in R? >> >> > thankyou very much indeed in advance, >> >> > Eliza >> >> > [[alternative HTML version deleted]] >> >> > >> >> > __ >> >> > R-help@r-project.org mailing list >> >> > https://stat.ethz.ch/mailman/listinfo/r-help >> >> > PLEASE do read the posting guide >> >> > http://www.R-project.org/posting-guide.html >> >> > and provide commented, minimal, self-contained, reproducible code. >> >> >> >> >> >> >> >> -- >> >> Pascal Oettli >> >> Project Scientist >> >> JAMSTEC >> >> Yokohama, Japan >> >> >> >> -- >> Pascal Oettli >> Project Scientist >> JAMSTEC >> Yokohama, Japan -- Pascal Oettli Project Scientist JAMSTEC Yokohama, Japan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] open unknown file format in R
Thankyou very much indeed.My limited knowledge of R is forcing me to ask you that how did you know the following information (AphroJP, 123°E-146°E, 24°N-46°N, resolution 0.05x0.05 i.e. 440 rows x 460columns)? Thanks, Eliza > From: kri...@ymail.com > Date: Tue, 18 Mar 2014 21:39:58 +0900 > Subject: Re: [R] open unknown file format in R > To: eliza_bo...@hotmail.com > CC: r-help@r-project.org > > Hello, > > It is not around the world. It is only for Japan (AphroJP, > 123°E-146°E, 24°N-46°N, resolution 0.05x0.05 i.e. 440 rows x 460 > columns). You can store in a Raster* object then extract the grid > points you need, with the coordinates. > > HTH > Pascal > > > > On Tue, Mar 18, 2014 at 9:21 PM, eliza botto wrote: > > Hi Pascal, > > > > Your code worked out perfectly but I have one question though. You wrote > > that you did not use stations. What if I want to read stations as i am only > > > > interest in a part of data. I need it because the file has data for 202400 > > stations around the globe and I am only interest in data of 22 stations. > > > > Thankyou very much in advance, > > > > Eliza > > > > > >> From: kri...@ymail.com > >> Date: Tue, 18 Mar 2014 08:51:01 +0900 > >> Subject: Re: [R] open unknown file format in R > >> To: eliza_bo...@hotmail.com > >> CC: r-help@r-project.org > >> > >> Hello, > >> > >> It is in binary format. I didn't use stations. But to read the gridded > >> format, I used: > >> > >> > readBin(fid, numeric(), n=1e8, size=4, signed=TRUE, endian='little') > >> > >> where file is the connection created with file() > >> > >> Hope this helps, > >> Pascal > >> > >> > >> > >> > >> On Tue, Mar 18, 2014 at 4:06 AM, eliza botto > >> wrote: > >> > Dear R-Family, > >> > I have just downloaded a massive data file from internet > >> > (AphroJP_62STN_V1005.1900.gz). Apparently, the file is compressed with > >> > .gz. > >> > When I uncompressed > >> > it, the file was saved in the name (AphroJP_62STN_V1005.1900) of unknown > >> > format. How can I open it in R? > >> > thankyou very much indeed in advance, > >> > Eliza > >> > [[alternative HTML version deleted]] > >> > > >> > __ > >> > R-help@r-project.org mailing list > >> > https://stat.ethz.ch/mailman/listinfo/r-help > >> > PLEASE do read the posting guide > >> > http://www.R-project.org/posting-guide.html > >> > and provide commented, minimal, self-contained, reproducible code. > >> > >> > >> > >> -- > >> Pascal Oettli > >> Project Scientist > >> JAMSTEC > >> Yokohama, Japan > > > > -- > Pascal Oettli > Project Scientist > JAMSTEC > Yokohama, Japan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] open unknown file format in R
Hello, It is not around the world. It is only for Japan (AphroJP, 123°E-146°E, 24°N-46°N, resolution 0.05x0.05 i.e. 440 rows x 460 columns). You can store in a Raster* object then extract the grid points you need, with the coordinates. HTH Pascal On Tue, Mar 18, 2014 at 9:21 PM, eliza botto wrote: > Hi Pascal, > > Your code worked out perfectly but I have one question though. You wrote > that you did not use stations. What if I want to read stations as i am only > > interest in a part of data. I need it because the file has data for 202400 > stations around the globe and I am only interest in data of 22 stations. > > Thankyou very much in advance, > > Eliza > > >> From: kri...@ymail.com >> Date: Tue, 18 Mar 2014 08:51:01 +0900 >> Subject: Re: [R] open unknown file format in R >> To: eliza_bo...@hotmail.com >> CC: r-help@r-project.org >> >> Hello, >> >> It is in binary format. I didn't use stations. But to read the gridded >> format, I used: >> >> > readBin(fid, numeric(), n=1e8, size=4, signed=TRUE, endian='little') >> >> where file is the connection created with file() >> >> Hope this helps, >> Pascal >> >> >> >> >> On Tue, Mar 18, 2014 at 4:06 AM, eliza botto >> wrote: >> > Dear R-Family, >> > I have just downloaded a massive data file from internet >> > (AphroJP_62STN_V1005.1900.gz). Apparently, the file is compressed with .gz. >> > When I uncompressed >> > it, the file was saved in the name (AphroJP_62STN_V1005.1900) of unknown >> > format. How can I open it in R? >> > thankyou very much indeed in advance, >> > Eliza >> > [[alternative HTML version deleted]] >> > >> > __ >> > R-help@r-project.org mailing list >> > https://stat.ethz.ch/mailman/listinfo/r-help >> > PLEASE do read the posting guide >> > http://www.R-project.org/posting-guide.html >> > and provide commented, minimal, self-contained, reproducible code. >> >> >> >> -- >> Pascal Oettli >> Project Scientist >> JAMSTEC >> Yokohama, Japan -- Pascal Oettli Project Scientist JAMSTEC Yokohama, Japan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] format of output of residual standard errors of manova()
Dear all, I wasn't successful in finding any related "bug" or "wish" report on bugs.r-project.org, svn.R-project.org/R/trunk/doc/NEWS.Rd, or RSeek regarding the following: The code of stats:::print.aov contains the two commands cat("Residual standard error: ", sapply(sqrt(ss/rdf), format), "\n", sep = "") and cat("Residual standard error: ", sapply(rs, format), "\n", sep = "") which provide the output of the RSEs. However, the RSE-values are glued together because of sep = "" in the call to cat(), which makes them hard or even impossible to read off free of doubt. (See the respective output of npk.aov2 in example( manova) or of fit in example( summary.manova).) Is it intended to change those lines of code into something like cat("Residual standard error: ", paste( sapply(sqrt(ss/rdf), format), collapse = "; "), "\n", sep = "") and cat("Residual standard error: ", paste( sapply(rs, format), collapse = "; "), "\n", sep = "") respectively? (Of course, any other sep-value would be "accepted". :)) If not, I would suggest this modification as a "wish" (and was wondering if my next step should indeed be submitting a wish report on bugs.r-project.org ...) Best regards -- Gerrit PS: sessionInfo() R version 3.0.2 (2013-09-25) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C [5] LC_TIME=German_Germany.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] fortunes_1.5-2 loaded via a namespace (and not attached): [1] tools_3.0.2 - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany Fax: +49-(0)641-99-32109http://www.uni-giessen.de/cms/eichner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Which() missing a number
Hi So perhaps doing neilist == pfriends is the same as doing neilist == rep(pfriends, 9)? neilist <- c(13, 15, 28, 29, 30, 13, 14, 15, 28, 30, 43, 44, 45, 14, 15, 29, 44, 45) pfriends <- c(13, 15) cbind(neilist == pfriends, neilist == rep(pfriends, 9)) [,1] [,2] [1,] TRUE TRUE [2,] TRUE TRUE [3,] FALSE FALSE [4,] FALSE FALSE [5,] FALSE FALSE [6,] FALSE FALSE [7,] FALSE FALSE [8,] TRUE TRUE [9,] FALSE FALSE [10,] FALSE FALSE [11,] FALSE FALSE [12,] FALSE FALSE [13,] FALSE FALSE [14,] FALSE FALSE [15,] FALSE FALSE [16,] FALSE FALSE [17,] FALSE FALSE [18,] FALSE FALSE And try this neilist == c(13,14,15,30) [1] TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [13] FALSE TRUE TRUE FALSE FALSE FALSE Warning message: In neilist == c(13, 14, 15, 30) : longer object length is not a multiple of shorter object length Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen Specialist, M.Sc., Ph.D. Plant Performance & Modeling Technology & Service Solutions T +45 9730 5135 M +45 2547 6050 fr...@vestas.com http://www.vestas.com Company reg. name: Vestas Wind Systems A/S This e-mail is subject to our e-mail disclaimer statement. Please refer to www.vestas.com/legal/notice If you have received this e-mail in error please contact the sender. > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Rainer Schuermann > Sent: 18. marts 2014 12:42 > To: r-help@r-project.org > Subject: Re: [R] Which() missing a number > > ... and it is also missing the 15 at position 15. > > Can't explain but > > > which( neilist %in% pfriends ) > > should give you what you want. > > > > On Tuesday 18 March 2014 11:14:08 Thomas wrote: > > Does anyone know why this is happening? Which() is picking up the > > indices of the numbers 13 and 15 in neilist, but it's missing out the > > 13 at index 6. > > > > Thank you, > > > > Thomas Chesney > > > > > neilist > > [1] 13 15 28 29 30 13 14 15 28 30 43 44 45 14 15 29 44 45 > > > > > pfriends > > [1] 13 15 > > > > > which(neilist==pfriends) > > [1] 1 2 8 > > > > > neilist[6] > > [1] 13 > > > > > str(neilist) > > int [1:18] 13 15 28 29 30 13 14 15 28 30 ... > > > > > str(pfriends) > > num [1:2] 13 15 > > > > > sessionInfo() > > R version 2.15.3 (2013-03-01) > > Platform: i386-apple-darwin9.8.0/i386 (32-bit) > > > > locale: > > [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF- > 8/en_GB.UTF-8 > > > > attached base packages: > > [1] splines grid stats graphics grDevices utils > > datasets methods > > [9] base > > > > other attached packages: > > [1] spdep_0.5-56coda_0.16-1 deldir_0.0-21 maptools_0.8-23 > > foreign_0.8-52 > > [6] nlme_3.1-108MASS_7.3-23 Matrix_1.0-11 lattice_0.20-13 > > boot_1.3-7 > > [11] sp_1.0-8igraph_0.6.5-1 > > > > loaded via a namespace (and not attached): > > [1] LearnBayes_2.12 tools_2.15.3 > > > > This message and any attachment are intended solely for the addressee > and may contain confidential information. If you have received this message > in error, please send it back to me, and immediately delete it. Please do > not > use, copy or disclose the information contained in this message or in any > attachment. Any views or opinions expressed by the author of this email do > not necessarily reflect the views of the University of Nottingham. > > > > This message has been checked for viruses but the contents of an > attachment > > may still contain software viruses which could damage your computer > system, you are advised to perform your own checks. Email communications > with the University of Nottingham may be monitored as permitted by UK > legislation. > > > > __ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > > and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Which() missing a number
On 18/03/2014 7:14 AM, Thomas wrote: Does anyone know why this is happening? Which() is picking up the indices of the numbers 13 and 15 in neilist, but it's missing out the 13 at index 6. Thank you, Thomas Chesney > neilist [1] 13 15 28 29 30 13 14 15 28 30 43 44 45 14 15 29 44 45 > pfriends [1] 13 15 > which(neilist==pfriends) [1] 1 2 8 Two problems with your code. The first is recycling. Your expression neilist == pfriends compares neilist[1] with pfriends[1], then neilist[2] with pfriends[2], then neilist[3] with pfriends[1], etc. The second problem is that pfriends is not an integer vector, so it may actually contain 13.001 and 14.99 (or similar numbers that round to 13 and 15 when printed), and those won't test equal to 13 and 15. Duncan Murodch > neilist[6] [1] 13 > str(neilist) int [1:18] 13 15 28 29 30 13 14 15 28 30 ... > str(pfriends) num [1:2] 13 15 > sessionInfo() R version 2.15.3 (2013-03-01) Platform: i386-apple-darwin9.8.0/i386 (32-bit) locale: [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages: [1] splines grid stats graphics grDevices utils datasets methods [9] base other attached packages: [1] spdep_0.5-56coda_0.16-1 deldir_0.0-21 maptools_0.8-23 foreign_0.8-52 [6] nlme_3.1-108MASS_7.3-23 Matrix_1.0-11 lattice_0.20-13 boot_1.3-7 [11] sp_1.0-8igraph_0.6.5-1 loaded via a namespace (and not attached): [1] LearnBayes_2.12 tools_2.15.3 This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] open unknown file format in R
Hi Pascal, Your code worked out perfectly but I have one question though. You wrote that you did not use stations. What if I want to read stations as i am only interest in a part of data. I need it because the file has data for 202400 stations around the globe and I am only interest in data of 22 stations. Thankyou very much in advance, Eliza > From: kri...@ymail.com > Date: Tue, 18 Mar 2014 08:51:01 +0900 > Subject: Re: [R] open unknown file format in R > To: eliza_bo...@hotmail.com > CC: r-help@r-project.org > > Hello, > > It is in binary format. I didn't use stations. But to read the gridded > format, I used: > > > readBin(fid, numeric(), n=1e8, size=4, signed=TRUE, endian='little') > > where file is the connection created with file() > > Hope this helps, > Pascal > > > > > On Tue, Mar 18, 2014 at 4:06 AM, eliza botto wrote: > > Dear R-Family, > > I have just downloaded a massive data file from internet > > (AphroJP_62STN_V1005.1900.gz). Apparently, the file is compressed with .gz. > > When I uncompressed > > it, the file was saved in the name (AphroJP_62STN_V1005.1900) of unknown > > format. How can I open it in R? > > thankyou very much indeed in advance, > > Eliza > > [[alternative HTML version deleted]] > > > > __ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > -- > Pascal Oettli > Project Scientist > JAMSTEC > Yokohama, Japan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Which() missing a number
... and it is also missing the 15 at position 15. Can't explain but > which( neilist %in% pfriends ) should give you what you want. On Tuesday 18 March 2014 11:14:08 Thomas wrote: > Does anyone know why this is happening? Which() is picking up the > indices of the numbers 13 and 15 in neilist, but it's missing out the > 13 at index 6. > > Thank you, > > Thomas Chesney > > > neilist > [1] 13 15 28 29 30 13 14 15 28 30 43 44 45 14 15 29 44 45 > > > pfriends > [1] 13 15 > > > which(neilist==pfriends) > [1] 1 2 8 > > > neilist[6] > [1] 13 > > > str(neilist) > int [1:18] 13 15 28 29 30 13 14 15 28 30 ... > > > str(pfriends) > num [1:2] 13 15 > > > sessionInfo() > R version 2.15.3 (2013-03-01) > Platform: i386-apple-darwin9.8.0/i386 (32-bit) > > locale: > [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 > > attached base packages: > [1] splines grid stats graphics grDevices utils > datasets methods > [9] base > > other attached packages: > [1] spdep_0.5-56coda_0.16-1 deldir_0.0-21 maptools_0.8-23 > foreign_0.8-52 > [6] nlme_3.1-108MASS_7.3-23 Matrix_1.0-11 lattice_0.20-13 > boot_1.3-7 > [11] sp_1.0-8igraph_0.6.5-1 > > loaded via a namespace (and not attached): > [1] LearnBayes_2.12 tools_2.15.3 > > This message and any attachment are intended solely for the addressee and may > contain confidential information. If you have received this message in error, > please send it back to me, and immediately delete it. Please do not use, > copy or disclose the information contained in this message or in any > attachment. Any views or opinions expressed by the author of this email do > not necessarily reflect the views of the University of Nottingham. > > This message has been checked for viruses but the contents of an attachment > may still contain software viruses which could damage your computer system, > you are advised to perform your own checks. Email communications with the > University of Nottingham may be monitored as permitted by UK legislation. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Which() missing a number
I think you want to do which(neilist %in% pfriends) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Thomas Sent: Tuesday, March 18, 2014 6:14 AM To: r-help@r-project.org Subject: [R] Which() missing a number Does anyone know why this is happening? Which() is picking up the indices of the numbers 13 and 15 in neilist, but it's missing out the 13 at index 6. Thank you, Thomas Chesney > neilist [1] 13 15 28 29 30 13 14 15 28 30 43 44 45 14 15 29 44 45 > pfriends [1] 13 15 > which(neilist==pfriends) [1] 1 2 8 > neilist[6] [1] 13 > str(neilist) int [1:18] 13 15 28 29 30 13 14 15 28 30 ... > str(pfriends) num [1:2] 13 15 > sessionInfo() R version 2.15.3 (2013-03-01) Platform: i386-apple-darwin9.8.0/i386 (32-bit) locale: [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages: [1] splines grid stats graphics grDevices utils datasets methods [9] base other attached packages: [1] spdep_0.5-56coda_0.16-1 deldir_0.0-21 maptools_0.8-23 foreign_0.8-52 [6] nlme_3.1-108MASS_7.3-23 Matrix_1.0-11 lattice_0.20-13 boot_1.3-7 [11] sp_1.0-8igraph_0.6.5-1 loaded via a namespace (and not attached): [1] LearnBayes_2.12 tools_2.15.3 This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fwd: R basic data manipulation Queries
Sent from Samsung Mobile Original message Subject: R basic data manipulation Queries From: Pavneet Arora To: pavnee...@yahoo.co.uk CC: Hello Guys I am new in R, so please excuse the really basic questions. I have tried reading numeral tutorials, but I am still stuck. Question 1: If I perform correlation on my data [cor(nums2)] or try to produce variance matrix [var(nums2)]. The output comes in R console. Is there any way I can make it go directly to excel somehow? Question 2: Also is there any way I can permanently change the variable name in a data frame. I basically imported my dataset from SAS using "read.ssd" function in library(foreign). However, this package cuts off the variable names and only allows 8 characters! So that means I will have to rename some of my variable names, so they make more sense as to what it is. part (a): At the moment, I did the following to change the variable names, using library(plyr). First of all, is this the most succint way of doing this? new_acc <- rename(acc_mod,c("NAME_OF_"="weekName", "ACCIDENT"="AccSev", "YEARMONH"="YrMonHr", "X_1ST_ROA"="1RdCls.N", "ROAD_TYP"="RdType.N", "LOCATION"="LocEast")) part (b): Secondly, I wanted to do the above, to change the name permanently - but I don't think it worked, because when I do the following, I get: class(LocEast) # New name of "LOCATION" class(LOCATION) R Output: > class(LocEast) Error: object 'LocEast' not found > class(LOCATION) [1] "numeric" Thanks so much! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Which() missing a number
Does anyone know why this is happening? Which() is picking up the indices of the numbers 13 and 15 in neilist, but it's missing out the 13 at index 6. Thank you, Thomas Chesney > neilist [1] 13 15 28 29 30 13 14 15 28 30 43 44 45 14 15 29 44 45 > pfriends [1] 13 15 > which(neilist==pfriends) [1] 1 2 8 > neilist[6] [1] 13 > str(neilist) int [1:18] 13 15 28 29 30 13 14 15 28 30 ... > str(pfriends) num [1:2] 13 15 > sessionInfo() R version 2.15.3 (2013-03-01) Platform: i386-apple-darwin9.8.0/i386 (32-bit) locale: [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages: [1] splines grid stats graphics grDevices utils datasets methods [9] base other attached packages: [1] spdep_0.5-56coda_0.16-1 deldir_0.0-21 maptools_0.8-23 foreign_0.8-52 [6] nlme_3.1-108MASS_7.3-23 Matrix_1.0-11 lattice_0.20-13 boot_1.3-7 [11] sp_1.0-8igraph_0.6.5-1 loaded via a namespace (and not attached): [1] LearnBayes_2.12 tools_2.15.3 This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] strangely long floating point with write.table()
On 14-03-17 8:43 PM, Mike Miller wrote: On Mon, 17 Mar 2014, Duncan Murdoch wrote: On 14-03-17 6:22 PM, Mike Miller wrote: Thanks! Another thing I've figured out: Use of "drop0trailing=T" in format() fixes the .0 stuff that I didn't like: write.table(format(data[1:10,], digits=5, trim=T, drop0trailing=T), row.names=F, col.names=F, quote=F) [snip] I still have more to figure out, but for most smaller table-writing jobs, I think something like the last command above will be my usual approach. In real life, I would use a tab delimiter, though. I'm still unsure about the best way for dealing with very large data frames, though. There's probably a good way to stream data into a file so that it doesn't have to be written as an additional large object in memory. There must be a way to make a connection and then just pipe the formatted data into it. Maybe something related to sprintf() will work. You've never explained why you want to write these gigantic text files. Text is a lossy way to store numbers: it takes 15 bytes to store about 8 bytes of information, and you'll probably lose a few bits at the end. Why not write your files in binary, storing exactly what you have in memory? It'll be a lot faster to write and to read, you won't need to duplicated before writing, etc. Thanks for asking, Duncan. A typical problem is that I am running 12 processes at once on a 12-core machine with 32 GB of RAM, so each process has to be limited to about 2.5 GB total. Then I try to load as much data as I can within that limitation. The output data does not always need to be in text format, but it usually does because it has to be read by other programs. Other programs are unlikely to be able to read save() files, but they should be able to read the output of writeBin. Not all programs can do it easily, e.g. I wouldn't want to try to do that in Excel (though I think you can using VBA), but most should be able to. The main reasons to use text files are so that humans can read the output or so that you can keep it for a long time and not worry about losing the documentation of the internal format; neither of those seems to apply to your use case. Binary files are better for interprocess communication, because you skip two conversion steps. Duncan Murdoch I was hoping I could read a line from a data frame and format it like this: sprintf(c(rep("%s",2), rep("%d",2), rep("%.4f",4)), data[1,1:8]) But sprintf reads vectors, so they have to be of a single type. Thanks for your help. Mike __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] open unknown file format in R
Dear Pascal, Dan and Macqueen, Thankyou very much for your help. With pascal' code I was managed reading the file. Thanks, Eliza > From: kri...@ymail.com > Date: Tue, 18 Mar 2014 08:51:01 +0900 > Subject: Re: [R] open unknown file format in R > To: eliza_bo...@hotmail.com > CC: r-help@r-project.org > > Hello, > > It is in binary format. I didn't use stations. But to read the gridded > format, I used: > > > readBin(fid, numeric(), n=1e8, size=4, signed=TRUE, endian='little') > > where file is the connection created with file() > > Hope this helps, > Pascal > > > > > On Tue, Mar 18, 2014 at 4:06 AM, eliza botto wrote: > > Dear R-Family, > > I have just downloaded a massive data file from internet > > (AphroJP_62STN_V1005.1900.gz). Apparently, the file is compressed with .gz. > > When I uncompressed > > it, the file was saved in the name (AphroJP_62STN_V1005.1900) of unknown > > format. How can I open it in R? > > thankyou very much indeed in advance, > > Eliza > > [[alternative HTML version deleted]] > > > > __ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > -- > Pascal Oettli > Project Scientist > JAMSTEC > Yokohama, Japan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Double-logistic or double-sigmoid in R cran
Good morning everyone, I am looking for a package in R cran to fit a double logistic curve like this: http://en.wikipedia.org/wiki/File:Dsigmoid.png but the packages I've found are not running for my data, in particular: "phenex" package is specifical for NDVI data, "FlexParamCurve" is really interesting but it seems that id does not allow this specifical fitting. Could someone give me some advices? Thank you a lot! __ If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/Double-logistic-or-double-sigmoid-in-R-cran-tp4687028.html This email was sent by Phalaen (via Nabble) To receive all replies by email, subscribe to this discussion: http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=subscribe_by_code&node=4687028&code=ci1oZWxwQHItcHJvamVjdC5vcmd8NDY4NzAyOHwtNzg0MjM1NTA4 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] is it possible to get the coordinate of mtext()?
On Mon, 17 Mar 2014 15:18:50 -0700 Jinsong Zhao wrote > Hi there, > > I hope to rotate the Y label of axis(4) with -90 degree. I can typeset > the Y label using text() with srt = -90. However, I cannot get the > coordinate of the position that mtext() used. > <...cut...> locator(1) # Works for me... ?locator Cheers, D. South Africas premier free email service - www.webmail.co.za Cotlands - Shaping tomorrows Heroes http://www.cotlands.org.za/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.