Is there a way in R to enter passwords interactively to the command line and hide them from the screen? I know there's readLine, but I do not know passwords can be hidden there.... moreIs there a way in R to enter passwords interactively to the command line and hide them from the screen? I know there's readLine, but I do not know passwords can be hidden there. Assume you want to connect to a database using ROracle or RMySQL and do not want to store the password in a script but rather make the user enter it every time a query is executed.
Yes, we had a similar question around here, but I feel that the situation has changed and it's worth to address to problem again. Unfortunately tcltk won't work on RStudio (Server).
However I have seen the folks at R Studio found a solution for their version control support. I remember previous versions where I could see my repo password every time I enter it in R Studio, but now that seems to be fixed. I know it's likely R Studio technique, but is there a way mortal R users can access it when working with R Studio Server? less
I need to "industrialize" an R code for a data science project, because the project will be rerun several times in the future with fresh data. The new code should be really easy... moreI need to "industrialize" an R code for a data science project, because the project will be rerun several times in the future with fresh data. The new code should be really easy to follow even for people who have not worked on the project before and they should be able to redo the whole workflow quite quickly. Therefore I am looking for tips, suggestions, resources and best-practices on how to achieve this objective.
Thank you for your help in advance!
I installed R studio 1.2.1335 in my Pc powered by Win 7 x64. after installation when i try to open R studio shows error "api-ms-win-crt-runtime-l1-1-0.dll is missing" how to fix... moreI installed R studio 1.2.1335 in my Pc powered by Win 7 x64. after installation when i try to open R studio shows error "api-ms-win-crt-runtime-l1-1-0.dll is missing" how to fix this error?
I tried to reinstall R studio, but problem continuous
Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH:... moreCould not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/nickopotamus/.local/share/r-miniconda/envs/r-reticulate/lib:/usr/lib/R/lib::/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/lib/server
sudo find / -name 'libcudart.so.11.0' finds the file in:
/home/nickopotamus/.local/share/r-miniconda/envs/r-reticulate/lib/libcudart.so.11.0
/home/nickopotamus/anaconda3/pkgs/cudatoolkit-11.3.1-h2bc3f7f_2/lib/libcudart.so.11.0
/home/nickopotamus/anaconda3/pkgs/cudatoolkit-11.2.0-h73cb219_8/lib/libcudart.so.11.0
/home/nickopotamus/anaconda3/pkgs/cudatoolkit-11.2.72-h2bc3f7f_0/lib/libcudart.so.11.0
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudart.so.11.0
The top entry at least appears to be in the path that the error is searching, so I'm at a bit of a loss as to what to try next. Is it a conflict with the other anaconda packages (which I can't seem to remove), or am I simply being... less
We are confused on the difference between R and R studio. We do the majority of our work on R studio but we were required to download R as well. Is regular R necessary for R... moreWe are confused on the difference between R and R studio. We do the majority of our work on R studio but we were required to download R as well. Is regular R necessary for R studio to work?
I need to write the equivalent of the following code in R but I'm not quite sure how to go about it:
def add(args):
result = args + args
return... moreI need to write the equivalent of the following code in R but I'm not quite sure how to go about it:
def add(args):
result = args + args
return result
The reason why is because for the platform I am using (Cloudera Data Science Workbench) models need a JSON input to be able to call them using an API key
So if I write a test model in R such as:
f <- function(x, y) {
return (x + y)
}
I cannot do a call like {"x" : 2, "y" : 4} using the httr package.
So I either need to make a dictionary like call for functions in R
OR
I am simply calling JSON incorrectly in which case could someone help me format that correctly for an API call
Thanks less
I am facing problem while downloading 'caret' package in R studios. The code below was taken from the caret documentation.
install.packages("caret", dependencies = c("Depends",... moreI am facing problem while downloading 'caret' package in R studios. The code below was taken from the caret documentation.
install.packages("caret", dependencies = c("Depends", "Suggests"))
it works fine while installing but it gives Errors and Warnings while unpacking few packages like mentioned below:
ERROR: dependencies ‘eiPack’, ‘ei’, ‘MCMCpack’, ‘Zelig’ are not available for package ‘ZeligEI’
* removing ‘/home/shazil/R/x86_64-pc-linux-gnu-library/3.4/ZeligEI’
Warning in install.packages :
installation of package ‘ZeligEI’ had non-zero exit status
At the end when the whole installation process is finished it says:
The downloaded source packages are in
‘/tmp/RtmpeiP5GO/downloaded_packages’
After that when I use the library() command, the following Error appears
> library(caret)
Error in library(caret) : there is no package called ‘caret’
I am using Ubuntu 16.04, Dell machine Core i5 7th Gen, 6GB RAM AMD RADEON GRAPHICS
Would really appreciate... less
I have recently discovered you can use R within Tableau, to return bool, int, long etc. This happens by the... moreI have recently discovered you can use R within Tableau, to return bool, int, long etc. This happens by the following:
install.packages("Rserve")
library(Rserve)
Rserve()
// Should say "Starting RServe..."
Then in Tableau:
// For Tableau under 'Help' > 'Settings and Performance' > 'Manage R Connections'
// Server: 127.0.0.1 and Port:6311
// Make sure that 'RStudio' with 'RServer' is installed and running prior to Tableau connection
However I would like to do the same thing with Python, so Python can be used as a script in Tableau (not using Tableau's api in Python) - anyone know if this is possible? The snippet above was taken from here
I'm trying to figure out how saving works in R Studio.
When i create a new project, a .RProj file is created. Whenever I work in R Studio, Save and Save As are greyed out in the... moreI'm trying to figure out how saving works in R Studio.
When i create a new project, a .RProj file is created. Whenever I work in R Studio, Save and Save As are greyed out in the File menu. The only way I know how to create a .RProj file is when starting a new project.
In the environment section, I can see a floppy disk Save icon. When I click that, it creates a .RData file. When ever I want to save, I click on that save icon and overwrite the file.
Can someone please explain what the best practices are for saving when using R Studio and the key distinctions between the .RProj and .RData files? less
I am trying my hands at grabbing data from an API in R.
The API I am using is the Data Science Toolkit's street2coordinates.
Basically this API returns the coordinates for street... moreI am trying my hands at grabbing data from an API in R.
The API I am using is the Data Science Toolkit's street2coordinates.
Basically this API returns the coordinates for street addresses. I tried using it and it works fine when I pass just one address. Like This:
library(httr)
I am not sure how to pass multiple addresses to this function.
I tried doing this but the output is something I don't understand. It's a weird list.
addresses <- c("4600 Vegas Dr, Las Vegas, NV 89108","3600 Vegas Dr, Las Vegas, NV 89108")
url <- GET("http://www.datasciencetoolkit.org/street2coordinates/addresses")
Long story short, I am looking for a way to pass more than one address in the GET function. Is there a way to do this?
I've been using gsub("toreplace","replacement", myvector) to clean out data in R. While this works for commas and the like, removing "$" has no effect. So if I do... moreI've been using gsub("toreplace","replacement", myvector) to clean out data in R. While this works for commas and the like, removing "$" has no effect. So if I do gsub("$","",myvector) all the dollar signs remain in place.I think this is because $ is a special character in R. I tried escaping it "\$" but that yields the same result (no effect). And I couldn't find a resource on escaping special characters in R.Obviously I should do this in preprocessing. But I was wondering if anyone out there knew how to either a) escape special characters in R b) get rid of pesky $ in R directly. For science. less
It seems like R is really designed to handle datasets that it can pull entirely into memory. What R packages are recommended for signal processing and machine learning on very... moreIt seems like R is really designed to handle datasets that it can pull entirely into memory. What R packages are recommended for signal processing and machine learning on very large datasets that can not be pulled into memory?
If R is simply the wrong way to do this, I am open to other robust free suggestions (e.g. scipy if there is some nice way to handle very large datasets)
I've been using var.test and bartlett.test to check basic ANOVA assumptions, among others, homoscedascity (homogeniety, equality of variances). Procedure is quite simple for... moreI've been using var.test and bartlett.test to check basic ANOVA assumptions, among others, homoscedascity (homogeniety, equality of variances). Procedure is quite simple for One-Way ANOVA:
bartlett.test(x ~ g) # where x is numeric, and g is a factor
var.test(x ~ g)
But, for 2x2 tables, i.e. Two-Way ANOVA's, I want to do something like this:
bartlett.test(x ~ c(g1, g2)) # or with list; see latter:
var.test(x ~ list(g1, g2))
Of course, ANOVA assumptions can be checked with graphical procedures, but what about "an arithmetic option"? Is that, at all, manageable? How do you test homoscedascity in Two-Way ANOVA?
I'm trying to install ROracle package on a unix box. The package gets installed properly. But library(ROracle) does not work fine with the error
library(ROracle)
Error in... moreI'm trying to install ROracle package on a unix box. The package gets installed properly. But library(ROracle) does not work fine with the error
library(ROracle)
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/u01/group1/home/oracle/R/x86_64-redhat-linux-gnu-library/3.1/ROracle/libs/ROracle.so':
libclntsh.so.11.1: cannot open shared object file: No such file or directory
Error: package or namespace load failed for ‘ROracle’
The package installs fine from the command line , but just does not work in R studio. I went through lot of threads in forum and lot of them suggested to export the LD_LIBRARY_PATH and reset it.infact i went ahead and copied all the R system variables from command line into R Studio. But it still does not work out fine.
One thing i have also noticed is that the R system variables change every time i restart R studio. Can it be the problem that R studio is not taking path values correctly. less
I know this is not a new concept by any stretch in R, and I have browsed the High Performance and Parallel Computing Task View. With that said, I am asking this question from a... moreI know this is not a new concept by any stretch in R, and I have browsed the High Performance and Parallel Computing Task View. With that said, I am asking this question from a point of ignorance as I have no formal training in Computer Science and am entirely self taught.
Recently I collected data from the Twitter Streaming API and currently the raw JSON sits in a 10 GB text file. I know there have been great strides in adapting R to handle big data, so how would you go about this problem? Here are just a handful of the tasks that I am looking to do:
Read and process the data into a data frame
Basic descriptive analysis, including text mining (frequent terms, etc.)
Plotting
Is it possible to use R entirely for this, or will I have to write some Python to parse the data and throw it into a database in order to take random samples small enough to fit into R.
Simply, any tips or pointers that you can provide will be greatly appreciated. Again, I won't take offense if you describe solutions at a 3rd... less
Is there an easy way to transfer to a tableau format(only keeps the parent level once)? I understand that the target format is not good in data science. But it makes the report... moreIs there an easy way to transfer to a tableau format(only keeps the parent level once)? I understand that the target format is not good in data science. But it makes the report easy to read. I can easily write it to excel and send the report to my boss..
library(data.table)
(dt <- data.table(Parent_Product=c("A","A","A","B","B","B"),
Sub_Product=c("red","red","blue","yellow","pink","pink"),
Sub_Product1=c(1,2,3,4,5,6),
Value=c(100,200,300,400,500,600)))
#> Parent_Product Sub_Product Sub_Product1 Value
#> 1: A red 1 100
#> 2: A red 2 200
#> 3: A blue 3 300
#> 4: B yellow 4 400
#> 5: B pink 5 500
#> 6: B pink 6 600
(target_dt <- data.table(Parent_Product=c("A",NA,NA,"B",NA,NA),
Sub_Product=c("red",NA,"blue","yellow","pink",NA),
... less
is their any possible way to call all the R packages/libraries and functions (packages like raster, rgdal, maptools etc.) in .net framework so that i am able to access all the features of R and run R script using .Net frontend....
I'm working on an application that requires a great deal of stastical processing and output as images in a .net desktop application. The problems, including generating the output... moreI'm working on an application that requires a great deal of stastical processing and output as images in a .net desktop application. The problems, including generating the output images, seem like a natural fit for R http://www.r-project.org/
Is there a wrapper, API, SDK, or port that will allow me to call R from .net?
Using machine learning in R while generating formula ~. ,data,what does . indicatefor example
fit <- svm(factor(outcome)~., data= train, probability= T)
pre <- predict(fit, test,... moreUsing machine learning in R while generating formula ~. ,data,what does . indicatefor example
fit <- svm(factor(outcome)~., data= train, probability= T)
pre <- predict(fit, test, decision.value= T, probability= T)
I am studying R end Data Science. In a question, I need to validate if a number in an array is even.
My code:
vetor <- list(c(1, 2, 3, 4, 5, 6, 7, 8, 9,... moreI am studying R end Data Science. In a question, I need to validate if a number in an array is even.
My code:
vetor <- list(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
for (i in vetor) {
if (i %% 2 == 0) {
print(i)
}
}
But the result is a warning message:
Warning message:
In if (i%%2 == 0) { :
a condição tem comprimento > 1 e somente o primeiro elemento será usado
Translating:
The condition has a length > 1 and only the first element will be used.
What I need, that each element in a list be verified if is even, and if true, then, print it.
In R, how can I do it? less
I am trying to get the second last value in each row of a data frame, meaning the first job a person has had. (Job1_latest is the most recent job and people had a different number... moreI am trying to get the second last value in each row of a data frame, meaning the first job a person has had. (Job1_latest is the most recent job and people had a different number of jobs in the past and I want to get the first one). I managed to get the last value per row with the code below:first_job <- function(x) tail(x, 1)first_job <- apply(data, 1, first_job)
structure(list(Index = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59),
FromJob = c("Senior Machine Learning Engineer", "Senior Machine Learning Engineer",
"Senior Machine Learning Engineer", "Senior Machine Learning Engineer",
"Senior Machine Learning Engineer", "Python Data Engineer (m/w/d)",
"Python Data Engineer (m/w/d)", "Python Data Engineer (m/w/d)",
"Lead Backend Developer (f/m/d)", "Lead Backend Developer (f/m/d)",
"Lead... less
For my stats class, I'm using R to do some of the math for my term project. The class doesn't call for it, but I want to supplement myself by learning R, which is my weaker... moreFor my stats class, I'm using R to do some of the math for my term project. The class doesn't call for it, but I want to supplement myself by learning R, which is my weaker language.
Using this data: skittle-data.csv (Every row was an individual bag of skittles submitted by each student)
I'm trying to generate some charts and other things to satisfy the assignment. While doing so, I noticed that in determining the total number of skittles I was off by 1.
When I load the csv into a dataframe I make summations of the rows, and then sum those summations to get the total, like this:
skittles = read.csv("skittle-data.csv", header = TRUE)
columnTotals = colSums(skittles, na.rm=FALSE, dims = 1)
rowTotals = rowSums(skittles, na.rm=FALSE, dims = 1)
total = sum(rowTotals, na.rm=FALSE, dims = 1)
I have a number of columns that I would like to remove from a data frame. I know that we can delete them individually using something like:
df$x <- NULL
But I was hoping to do... moreI have a number of columns that I would like to remove from a data frame. I know that we can delete them individually using something like:
df$x <- NULL
But I was hoping to do this with fewer commands.
Also, I know that I could drop columns using integer indexing like this:
df <- df
But I am concerned that the relative position of my variables may change.
Given how powerful R is, I figured there might be a better way than dropping each column one by one.