rstudio

How to apply a function to multiple columns to create multiple new columns in R?

我只是一个虾纸丫 提交于 2021-02-07 10:30:14
问题 I've this list of sequences aqi_range and a dataframe df : aqi_range = list(0:50,51:100,101:250) df PM10_mean PM10_min PM10_max PM2.5_mean PM2.5_min PM2.5_max 1 85.6 3 264 75.7 3 240 2 105. 6 243 76.4 3 191 3 95.8 19 287 48.4 8 134 4 85.5 50 166 64.8 32 103 5 55.9 24 117 46.7 19 77 6 37.5 6 116 31.3 3 87 7 26 5 69 15.5 3 49 8 82.3 34 169 49.6 25 120 9 170 68 272 133 67 201 10 254 189 323 226 173 269 Now I've created these two pretty simple functions that i want to apply to this dataframe to

E-mail (or similar) notification when code execution is finished

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-07 06:31:30
问题 I am currently doing several simulations in R that each take quite a long time to execute and the time it takes for each to finish varies from case to case. To use the time in between more efficiently, I wondered if it would be possible to set up something (like a e-mail notification system or similar) that would notify me as soon a a chunk of simulation is completed. Does somebody here have any experience with setting up something similar or does someone know a resource that could teach me

Why does object beginning with a period not appear in the global environment pane in rstudio? [duplicate]

三世轮回 提交于 2021-02-05 09:34:48
问题 This question already has an answer here : Declare variable with a dot at the begining in R [closed] (1 answer) Closed 1 year ago . Create object .object <- 2 Confirm object exists in global namespace .object # [1] 2 yet 回答1: Because variables starting with a . are hidden If you do ls() you'll not find that object. From ?ls all.names a logical value. If TRUE, all object names are returned. If FALSE, names which begin with a . are omitted. To get that name in the environment you need to do ls

RStudio - no symbol named 'X' in scope

本小妞迷上赌 提交于 2021-02-04 18:17:32
问题 Why do I get the yellow triangular warnings in the LHS margin in RStudio when using packages like dplyr? When I begin to use my current version of RStudio (1.0.136) there are no warnings. Then I start to code, mistype something, and a whole bunch of the yellow triangles appear. Yet if I restart RStudio, I begin again with none. Is there a way to suppress and/or prevent this? 回答1: Those are code diagnostics, designed to help you catch errors and fix them. You can turn them off if they are

Make sure all default packages are loaded before running .Rprofile

自闭症网瘾萝莉.ら 提交于 2021-02-04 17:54:33
问题 I have a couple of RStudio projects that I've set up to automate tasks like grading multiple choice tests. The functions necessary to do the tasks are just saved in a text file, and to make sure they're available to me or other users I've been using an .Rprofile file that just runs something like source("MyFunctions.R") on startup. If an .Rprofile file is in the base directory of an RStudio project, it's automatically run when opening the project However, I've run into occasional errors where

Package environment manipulation and submitting to CRAN

别来无恙 提交于 2021-01-29 14:17:16
问题 I have built a package for shiny that allows the user to interact with reactive objects in their global environment. I think it's a game changer for troubleshooting. However, I know that CRAN will reject this due to the manipulation of the global environment. I see answers directing users to create a new environment but I don't see how to access the objects of that environment in the environment pane, I just see the environment name. If I run something like this from this example: Global

Efficient Named Entity Recognition in R

天涯浪子 提交于 2021-01-29 12:58:24
问题 I have below code in R for extracting person and locations from text: library(rvest) library(NLP) library(openNLP) page = pdf_text("C:/Users/u214738/Documents/NER_Data.pdf") text = as.String(page) sent_annot = Maxent_Sent_Token_Annotator() word_annot = Maxent_Word_Token_Annotator() install.packages("openNLPmodels", repos = "http://datacube.wu.ac.at/src/contrib/", type = "source") install.packages("openNLPmodels.en", repos = "http://datacube.wu.ac.at/", type = "source") install.packages(

apply RStudio editor themes to help files

家住魔仙堡 提交于 2021-01-29 12:31:27
问题 This is a follow-up question to a previous answer I got. Can I apply RStudio editor themes to help files? @Allan Cameron hinted that this is possible in his answer but I can't get it to work. My knowledge of css is poor but this page says that RStudio themes ( .rstheme file ) are just css files: Since an rstheme is just CSS, anything that you can do with CSS you can do in an rstheme. so I thought I could bring in some of that css code into my help files ( css version) to change colouring etc.

RStudio - Stargazer issue - text table

一笑奈何 提交于 2021-01-29 12:02:04
问题 I am currently learning RStudio (beginner level) and I have a question regarding stargazer function and especially how to create the table of descriptive statistics. I did start by updloading my dataset (called d ) and all relevant libraries like stargazer . I did run command line: stargazer(d, type = 'text', title = "Statistiques descriptives",digits = 1, out="table1.txt") There is an error message: *Error in if (nchar(text.matrix[r, c]) > max.length[real.c]) { : missing value where TRUE /

nodes labels after deleting in R

白昼怎懂夜的黑 提交于 2021-01-29 10:25:28
问题 I'm working with random graphs where the label of nodes are numbers from 1 to N. In my work, I'm deleting some nodes from the graph. My problem is that in R, after deleting is just renaming the nodes again from 1 to remaining N, how I can preserve the label of nodes after deleting ?? thanks a lot 回答1: If there is no name for a node, the node ID (number) is used to label the graph. To preserve the label, set the name of the nodes to their IDs before removing nodes. Here is a small example.