我想测试renv闪亮应用程序的包。\n这是我的虚拟应用程序:
library(pool)\nlibrary(fresh)\nlibrary(shiny)\n\n\nui <- fluidPage(\n titlePanel("Old Faithful Geyser Data"),\n sidebarLayout(\n sidebarPanel(\n sliderInput("bins",\n "Number of bins:",\n min = 1,\n max = 50,\n value = 30)\n ),\n\n mainPanel(\n plotOutput("distPlot")\n )\n )\n)\nserver <- function(input, output) {\n\n output$distPlot <- renderPlot({\n x <- faithful[, 2]\n bins <- seq(min(x), max(x), length.out = input$bins + 1)\n hist(x, breaks = bins, col = 'darkgray', border = 'white')\n })\n}\nshinyApp(ui = ui, server = server)\nRun Code Online (Sandbox Code Playgroud)\n请注意,我只加载 2 个库pool,但fresh没有使用它们。\n包init()中的命令renv正在我的项目路径上创建一个本地库:
我完全糊涂了!我在 R 中有一个一列数据框:
temp1 = structure(list(Hamburg = c("Hamburg", "4562", "4604")), class = "data.frame", row.names = c(NA,
-3L))
str(temp1)
'data.frame': 3 obs. of 1 variable:
$ Hamburg: chr "Hamburg" "4562" "4604"
Run Code Online (Sandbox Code Playgroud)
当我删除第一行时:
temp1 = temp1[-1,]
Run Code Online (Sandbox Code Playgroud)
那么剩下的就不再是数据帧了!而且我也没有列名!
temp1
[1] "4562" "4604"
str(temp1)
chr [1:2] "4562" "4604"
Run Code Online (Sandbox Code Playgroud)
我怎么能修好呢?我想保留数据帧结构,只是去掉第一行!
我正在尝试使用rasterR中的“ ”包获取SRTM数据,但是一旦我SRTM在getData命令中选择,就会出现以下错误:
library(raster)
srtm <- getData('SRTM', lon=16, lat=48)
trying URL 'ftp://xftp.jrc.it/pub/srtmV4/tiff/srtm_40_03.zip'
trying URL 'http://hypersphere.telascience.org/elevation/cgiar_srtm_v4/tiff/zip/srtm_40_03.ZIP'
downloaded 572 bytes
Error in .SRTM(..., download = download, path = path) : file not found
In addition: Warning messages:
1: In utils::download.file(url = aurl, destfile = fn, method = "auto", :
URL 'ftp://xftp.jrc.it/pub/srtmV4/tiff/srtm_40_03.zip': status was 'Couldn't resolve host name'
2: In utils::unzip(zipfilename, exdir = dirname(zipfilename)) :
error 1 in extracting from zip file
Run Code Online (Sandbox Code Playgroud)
任何想法,这是什么错误?
我有一个列表如下:
l = list(list(v = numeric(0), pos = 10), list(v = numeric(0), pos = 10),
list(v = numeric(0), pos = 10), list(v = 1.227, pos = 19),
list(v = 1.227, pos = 19), list(v = 15.2, pos = 19))
Run Code Online (Sandbox Code Playgroud)
我想v从每个列表中提取元素。我已经检查过这个解决方案,但它对我不起作用。rapply使用andunique函数的第一个方法也将包含这些pos值,而且我想保留所有v值,即使它们重复或为零或numeric(0)!第二种方法:
matrix(unlist(l),ncol=2,byrow=TRUE)
Run Code Online (Sandbox Code Playgroud)
也不起作用,因为numeric(0)我的列表中有一些值v!
我正在尝试通过此链接重现传单包上 Rstudio 示例的结果。它一直工作到第 5 节。当我尝试使用具有完全相同设置的 AddMarkers 命令时:
##### Location Names
Location <- c("Atlanta ","Los Angeles","Chicago","New York","Dallas","Baltimore","Phoenix","Charlotte","Houston","San Antonio", "Seattle" )
#### Latitude and Longitude values for each of the above location
Lat <- c(33.74401,33.82377,41.78798,40.767309,32.88153,39.148492,33.45444,35.2406,29.935842,29.44838,47.714965 )
Lon <- c(-84.56032,-118.2668,-87.7738,-73.978308,-96.64601,-76.796211,-112.32401,-81.04028,-95.398436,-98.39908,-122.127166 )
#### Some hypothetical number of orders shipped out of each location
Orders <- c(1992,2500,3600,2252,3650,3450,4145,3945,5050,4300,1987)
#### Let us create some hypothetical class flags for the cities
Type <- c(rep("Yoda",5),rep("Vader",6))
### Create data set from the above vectors
df <- data.frame(Location, Lat,Lon,Orders,Type)
mymap …Run Code Online (Sandbox Code Playgroud) 我想在r,whiteout行号中打印一个字符!我怎么做 :
print("character ",quote = FALSE , row.names = F)
[1] character
Run Code Online (Sandbox Code Playgroud)
在row.names = F没有做任何事情!我想拥有 :
print("character ",quote = FALSE, something to remove the line index)
character
Run Code Online (Sandbox Code Playgroud)