r

R Markdown: xtable is knitted partially with code to PDF

旧街凉风 提交于 2021-02-10 18:19:41
问题 I have problem with my tables when knitting them to PDF - the first table isn't printed properly although I used the same pattern for all 3 tables - the first table is printed partially with code: I used this code until the first table: ```{r echo=FALSE, warning=FALSE} library("markdown") library(xtable) options(xtable.comment = FALSE) ``` ## Aufgabe: Die durchschnittliche Anzahl an Brüchen für jeden Wolltyp und Druckvariante ist: ```{r echo=FALSE} round(with(warpbreaks, tapply(breaks, list

Position of elements from one vector in another vector with R

醉酒当歌 提交于 2021-02-10 18:18:41
问题 I wish to create a vector holding the position of elements from one vector in another vector . This is similar to the following questions: Get the index of the values of one vector in another? Is there an R function for finding the index of an element in a vector? The match function in base R works in the simplest case, shown here: a <- c(1,1,2,2,3,3,4,4,5,5) b <- c(1,2,3,4,5) desired.output <- c(1,3,5,7,9) match(b,a) #[1] 1 3 5 7 9 However, match does not appear to work in more complex cases

volume from the surface down to a contour in R

核能气质少年 提交于 2021-02-10 18:12:19
问题 I need to find the volume from the surface down to a specific contour in R. Taking the contour example from the R help files: x <- 10*1:nrow(volcano) y <- 10*1:ncol(volcano) contour(x,y,volcano) given the resulting graph, how do I find the volume from a specific contour line up to the surface. In practice, I will use bkde2D to get a density map for a scatter plot. From this I can make the contour plot, but I would like to determine the volume defined by various density cutoffs in the

Is there a way to make leaflet map popup responsive on R?

血红的双手。 提交于 2021-02-10 18:11:31
问题 I use this R code (data was changed) to create an html file that I keep on a server: library(leaflet) leaflet() %>% addProviderTiles(providers$OpenStreetMap) %>% setView(lng=2.333333, lat=48.866667, zoom=12) %>% addMarkers(lng=2.333333, lat=48.866667, popup='Test') The problem is that when I render the file on a browser using a mobile phone, the pin and popup are extremely small and the size doesn't change when I zoom on the map. Is there a way to make the pin and popup bigger ? 回答1: The idea

Is there a way to make leaflet map popup responsive on R?

可紊 提交于 2021-02-10 18:11:24
问题 I use this R code (data was changed) to create an html file that I keep on a server: library(leaflet) leaflet() %>% addProviderTiles(providers$OpenStreetMap) %>% setView(lng=2.333333, lat=48.866667, zoom=12) %>% addMarkers(lng=2.333333, lat=48.866667, popup='Test') The problem is that when I render the file on a browser using a mobile phone, the pin and popup are extremely small and the size doesn't change when I zoom on the map. Is there a way to make the pin and popup bigger ? 回答1: The idea

Error in fix.by(by.x, x) : 'by' must specify a uniquely valid columnmergedata <- merge (dataset1, dataset2, by.x=“personalid”) [closed]

白昼怎懂夜的黑 提交于 2021-02-10 18:11:05
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Improve this question mergedata <- merge (dataset1, dataset2, by.x="personalid") Error in fix.by(by.x, x) : 'by' must specify a uniquely valid column 回答1: The OP had specified only the by.x . If the column names are the same, then by can be used merge(dataset1, dataset2, by="personalid

volume from the surface down to a contour in R

五迷三道 提交于 2021-02-10 18:11:03
问题 I need to find the volume from the surface down to a specific contour in R. Taking the contour example from the R help files: x <- 10*1:nrow(volcano) y <- 10*1:ncol(volcano) contour(x,y,volcano) given the resulting graph, how do I find the volume from a specific contour line up to the surface. In practice, I will use bkde2D to get a density map for a scatter plot. From this I can make the contour plot, but I would like to determine the volume defined by various density cutoffs in the

Graph bars only appear when lower limit of y axis set to 0 in ggplot

China☆狼群 提交于 2021-02-10 18:10:42
问题 I am trying to create a bar graph. When I set the limits as (0,7), the bars appear. However, I would like the lower limit to be 1, not 0. When I set the lower limit to 1, the bars do not appear. I get the following error message: Removed 8 rows containing missing values (geom_bar). It doesn't matter how I set the limits. I have used both of the following options: ylim(1, 7) scale_y_continuous(limits = c(1, 7)) Does anyone know how I can fix this? I'd like a graph that looks like this, but

How to extract information from a dataframe name and create a column based on it

99封情书 提交于 2021-02-10 18:07:45
问题 Here's some mock data that represents the data I have: pend4P_17k <- data.frame(x = c(1, 2, 3, 4, 5), var1 = c('a', 'b', 'c', 'd', 'e'), var2 = c(1, 1, 0, 0, 1)) pend5P_17k <- data.frame(x = c(1, 2, 3, 4, 5), var1 = c('a', 'b', 'c', 'd', 'e'), var2 = c(1, 1, 0, 0, 1)) I need to add a column to each data frame that represents the first letter/number code within the dataframe name, so for each dataframe I've been doing the following: pend4P_17k$Pendant_ID<-"4P" pend5P_17k$Pendant_ID<-"5P"

How to extract information from a dataframe name and create a column based on it

随声附和 提交于 2021-02-10 18:07:12
问题 Here's some mock data that represents the data I have: pend4P_17k <- data.frame(x = c(1, 2, 3, 4, 5), var1 = c('a', 'b', 'c', 'd', 'e'), var2 = c(1, 1, 0, 0, 1)) pend5P_17k <- data.frame(x = c(1, 2, 3, 4, 5), var1 = c('a', 'b', 'c', 'd', 'e'), var2 = c(1, 1, 0, 0, 1)) I need to add a column to each data frame that represents the first letter/number code within the dataframe name, so for each dataframe I've been doing the following: pend4P_17k$Pendant_ID<-"4P" pend5P_17k$Pendant_ID<-"5P"