2018-10-22 Georgia

## From R script to Power Bi - how to use setdiff

I've got two data frames: zerowy_nazwa5, zatwierdzony_nazwa5,and working 2 lines:setdiff(zatwierdzony_nazwa5, zerowy_nazwa5)setdiff(zerowy_nazwa5, zatwierdzony_nazwa5)how I implement this in PowerBi?Thanks for help Reading your question, I'm assuming this:Your main goal is to do this internally in PowerBIYou're not specifically asking how to do it using DAXThe Power of R in Power BI is not limited to R Visuals. You can load both single and multiple tables and use them as input to R scripts and any R functionality using Edit Queries > Transform > Run R Script.Here's... 2018-10-22 Yvette

## Is it possible to get R intellisense or console output in PowerBI?

I've been trying to get started using R in PowerBI. However, the lack of intellisense and the lack of console output is hindering me. As I can't develop the script in RStudio or in Visual Studio with those aids.EDIT: PowerBI does a nice thing where you can import data into the application and then work with the drag and drop tools to play around with the data, then when you select data fields that you want to add to an R plot, it creates an R stub that pulls those fields into a data.frame which makes things easy. However, that data is "inside" Power BI, I can't do the same ... 2018-10-22 Riva

## How to connect on MongoDB using R Script? (How to connect Power BI to MongoDB)

I need to connect Power BI on a MongoDB database, I tried using ODBC, but I have a lot os problems, then, I started to try to connect using R Script, but I still can't.For Power BI experts, how to connect Power BI to MongoDB?I tried the following script on Power BI:library("mongolite")newdb <- mongo(collection= "games", db = "admin", url = "mongodb://mongouser:mongopass@IP:PORT/admin", verbose = TRUE)But I have the following result:No collections or registers, but on Robo3T I see 3 collections and some registers. You can try using our MongoDB ODBC driver: https://www.... 2018-10-22 Calvin

## How to plot data from Excel using the R corrplot function?

I am trying to learn R, and use the corrplot library to draw Y:City and X: Population graph. I wrote the below code:When you look at the picture above, there are 2 columns City and population. When I run the code I get this error message:Error in cor(Illere_Gore_Nufus) : 'x' must be numeric.My excel data: Some assumptionsYou are asking how to do this in Excel, but your question is tagged R and Power BI (also RStudio, but that has been edited away), so I'm going to show you how to do this with R and Power BI. I'm also going to show you why you got that error message, and... 2018-10-22 Darren

## Publish R visuals from Power BI Desktop to Power BI Service (Unmanaged Tenant)

--- EDIT ---My problem was related to my domain not being a managed tenant.There are thus two correct answers to this question. The trivial answer where one simply publishes to Power BI Service from Power BI Desktop.The answer for this when one is an unmanaged tenant.For reference, below is still the original question.--- EDIT ---After extensive reading in Power BI's documentation and community posts, it is still not clear whether R visuals can be viewed in any other version of Power BI other than the desktop version, using .pbix files.This is not very useful, as many use c... 2018-10-22 Sebastian

## ggplot is showing every value instead of groups

I have a text file that is quite simple where is_MI is a dummy variable. is_MI blood_pressure0 1230 2220 1111 3331 123However, when I try to plot this code through a histogram or boxplotggplot(df_sbp) + geom_bar(mapping = aes(x = is_MI))Instead of having two bars, one for 0 and 1 each, it's listing out every single data point like . I've tried every combination of things for ggplot, but can't seem to work this out. I've also tried factor(is_MI). Here is the output for dput(droplevels(df_sbp[1:20, ])) as suggested by the comments. structure( list( ... 2018-10-22 Walker

## Writing functions: Creating data processing functions with R software

Hello fellow "R" users!Please spare me some of your time on helping me with the use of "R" software(Beginner) regarding "Data processing function", wherein I have three (3) different .csv files named "x2013, x2014, x2015" that has the same 6 columns as per respective year based on the image below: Problem and started typing the commands:filenames=list.files() library(plyr) install.packages("plyr") import.list=adply(filenames,1,read.csv)Although I just really wanted to summarize all the calls from the three source (csv). Any kind of help would be appreciated. Thank you for a... 2018-10-22 Sabina

## Problems with kriging function in R

I have a dataframe named as kef, consisted of 512 rows, and the fields x, y (referring to coordinates) and v (refering to a certain numeric value for each cell).I also have a map layer named as grecia.map, loaded in R through the readOGR command consisted of a polygon which represents a certain area.While running the following command:kriged <- kriging(kef$x, kef$y, kef$v, polygons = grecia.map, pixels=30000)I receive the following error messages:Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) casesIn addition: Warning messages:1: In... 2018-10-22 Madeline

## (How) can I use ddply to summarize a dataframe grouped by two factors?

Short version of question:How can I use ddply to summarize my dataframe grouped by several variables? I currently use this code to summarize by Condition: ddply(ExampleData, .(Condition), summarize, Average=mean(Var1, na.rm=TRUE), SD=sd(Var1),N=length(Var1), Med =median(Var1))How can I adjust the code to summarize by two variables (Condition and Block)?Desired output format something like: Condition Block Average SD N Med1 A 1 0.50 .. .. ..2 A 2 0.80 .. .. ..3 B 1 0.90 .. .. ..4 B 2 0.75 .. .. ..====Longer v... 2018-10-22 Carl

## finding the minimum value of multiple variables by group

I would like to find the minimum value of a variable (time) that several other variables are equal to 1 (or any other value). Basically my application is finding the first year that x ==1, for several x. I know how to find this for one x but would like to avoid generating multiple reduced data frames of minima, then merging these together. Is there an efficient way to do this? Here is my example data and solution for one variable.d <- data.frame(cat = c(rep("A",10), rep("B",10)), time = c(1:10), var1 = c(0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,1... 2018-10-22 Dora

## Perform several ANOVA's simultaneously on tidy data in R

I have a dataframe that looks like the following but with many additional rows. "Content" and "Process" can both either be "a" or "n". dv1 dv2 dv3 content process1 3 4 a a2 1 2 a n5 3 5 n a4 3 2 n nI know how to run several ANOVA's on data that is set up this way. I would run the following: dv <- df[,1:3]output <- lm(as.matrix(dv) ~ content * proces, data = df, contrasts = list(content = contr.sum, process = contr.sum))summary(aov(output))I am wondering if there is a way to do the same thing on a... 2018-10-22 Hogan

## R - ggplot boxplot with standard deviation values printed in the plot?

I've tried to write this question as clear and complete as possible, and would appreciate your constructive criticisms:I have a tibble named my_tibble that looks like this:# A tibble: 36 x 5# Groups: fruit [4] fruit length weight length_sd weight_sd <fct> <dbl> <dbl> <dbl> <dbl> 1 Apple 0.531 0.0730 0.211 0.0292 2 Apple 0.489 0.0461 0.211 0.0292 3 Apple 0.503 0.0796 0.211 0.0292 4 Apple 0.560 0.0733 0.211 0.0292 5 Apple 0.533 0.0883 0.211 0.0292 6 Apple 0.612 0.127 0.211 0.0292 7 ... 2018-10-22 Moses

## Why does filling a SpatialLinesDataFrame with lines throw an error?

I'm having trouble aggregating lines, resulting from a loop, in a SpatialLinesDataFrame (or similar). I have a range of coastlines which I itirate over, create perpendicular transects at equal intervals and ultimately like to store those transects. For each transect I will in a later stage run some calculations, like overlaying it on a raster to calculate the extent of a certain feature. So the final SpatialLinesDataFrame should allow me to access individual lines in a loop.Reproducable output table that corresponds to a shape ID in a shapefile.Position corresponds to an un... 2018-10-22 Phoebe

## Opening .bcp files in R

I have been trying to convert UK charity commission data which is in .bcp file format into .csv file format which could then be read into R. The data I am referring to is available here: http://data.charitycommission.gov.uk/. What I am trying to do is turn these .bcp files into useable dataframes that I can clean and run analyses on in R.There are suggestions on how to do this through python on this github page https://github.com/ncvo/charity-commission-extract but unfortunately I haven't been able to get these options to work. I am wondering if there is any syntax or packa... 2018-10-22 Glenn

## How to get elapsed time with system.time?

Is there a way to get just the numerical value of elapsed time from system.time?I want to measure the elapsed time of a bunch of functions I wrote. I call those functions like this:time_f1 <- system.time({ function_1(x,y,z) and some other stuff})time_f2 <- system.time({ function_2(x,y,z) and some other stuff})...time_f1 and the other measured times are objects of type proc_time and I have to extract the elapsed time.Is there a possibility to directly get only the numerical value of the elapsed times, so i can store them in a vector like this:time_f[1] <- system... 2018-10-22 Frederica