R

79

Solutions

5

Articles & Videos

209

Contributors

R is a programming language and environment used primarily for statistical data analysis.

Share tech news, updates, or what's on your mind.

Sign up to Post

I have an XML to parse and load it in to a dataframe. The XML has duplicate tag so using

xmldataframe <- xmlToDataFrame( "C:\\Sample.XML") is not working and throwing an error saying
Error in `[<-.data.frame`(`*tmp*`, i, names(nodes[[i]]), value = c("C",  :
  duplicate subscripts for columns

When I remove the duplicate tags manually and try to execute it works. But the problem is I have huge real time XML, i couldn't correct all of them, because I couldn't find the duplicate tags.

1. Is there a way to find out duplicate TAG's so I can remove manually?
2. If there are duplicates can i have clubbed in to same column in the dataframe?

Here is the sample XML.  


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IesEnhancedAttributes>
    <EnhancedAttribute>
        <action>C</action>
        <cleiCode>SDDFDFDFD</cleiCode>
        <physicalDescription>Small Form Factor(SFF), (e.g., SFP, GBIC, XFP, XPAK)</physicalDescription>
        <height_metric unit="mm">8.6</height_metric>
        <height_english unit="in">0.339</height_english>
        <width_metric unit="mm">13.7</width_metric>
        <width_english unit="in">0.539</width_english>
        <depth_metric unit="mm">56.5</depth_metric>
        <depth_english unit="in">2.224</depth_english>
            <depth_english unit="in">3.333</depth_english>
        <weight_metric unit="NS"></weight_metric>
        <weight_english unit="NS"></weight_english>
        <MaximumPowerUsage …
0
Industry Leaders: We Want Your Opinion!
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Hi Everyone - thanks in advance for taking a look and helping.

I'm trying to build a UDF in VBA that handles cohort math for digital media biz.

It takes as input several 1d arrays, builds a 3d array, then sums along two dimensions of that built array to output a 1d array.

Here's what I wrote in R, which I need to translate into VBA.

 
maus <- function(
  nreach,
  conversion,
  dispersion,
  dl,
  seasonal,
  sl,
  retention
) {
  
  
  n <- length(nreach)
  
  mau.array <- array(rep(0, n * n * n), dim = c(n, n, n))
  
  for (i in seq(n)) {
    for (j in seq(n)) {
      for (k in seq(n)) {
        if (!(i <= (k - j + 1))) {
          next
        }
        mau.array[i, j, k] <-
          nreach[i] * 
          conversion[i] *
          (
            (seasonal[((i + j) %% ds) + 1] * dispersion[j]) /
              sum(
                c(seasonal[(((max(i, j) - 1) %% ds) + 1) : ds], rep(seasonal, floor(dl / ds)))[1 : dl] *
                dispersion[1 : dl]
              )
          ) *
          retention[k - i - j + 2]
      }
    }
  }

maus <- colSums(colSums(mau.array))
return(maus)
  
}

Open in new window



Also attached is a sample workbook where I've tried to start this effort so you can see how I would use the function in Excel.  

I don't know VBA so would appreciate help translating the function I wrote in R into Excel VBA.  

Thank you in advance I really appreciate the help.
Cohort_Math.xlsm
0
Hello All Experts,
I am a student enthusiast in learning "Data Analytics" , which is the best platform to learn for FREE?
I want to Learn 'Data Science (Statistics)' & 'SAS/R' from scratch?
Any videos? Any websites? Any Blogs?

Thanks,

Regards,
Satish Kumar G N
0
Hi All,
While using REF keyword in my logical file , i get compilation error - "Record name same as name of file being created"

DDS of LF -

*************** Beginning of data *************************************
                                            REF(ACCOUNT)                
                R USEREF                                                
                  ACCLVL    R               REFFLD(ACCLEVELID ACCOUNT)  
                  ACCORG    R               REFFLD(ACTORGCOD  ACCOUNT)  
                  ACCNUM    R               REFFLD(ACCOUNTNUM ACCOUNT)  
****************** End of data ****************************************

May i know why is that so ?
0
Issue is that when I set a different it doesn't update neither my texblock.Text nor my listbox.Items;

Help very appreciated:)

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Windows.Services.Maps;
using Windows.Devices.Geolocation;


// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409

namespace New_World_Map
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
       

     

        List<string> stringlist = new List<string>();

        public MainPage()
        {
            this.InitializeComponent();

            this.RightTapped += MainPage_RightTapped;

            mapscontrol.CenterChanged += Mapscontrol_CenterChanged;

            listbox.DoubleTapped += Listbox_DoubleTapped;

            listview.Items.Add("Zoom In");

            listview.Items.Add("Zoom Out");

            listview.Items.Add("Navigate North");

            listview.Items.Add("Navigate South");

 …
0
gnn
bhhd
0
Team, need help resolving a laptop build that's continously failing at the bitlocker stage of task sequence, it's specific to just this model laptop, and I suspect it's related to some BIOS config.
Can you advise or direct me please,
Laptop Model = HP Elite X2 1012

______________________________________________________________________________________________________________________________________________
Error in logs:

... r
Initial TPM state: 55
Creating TPM owner authorization value
Succeeded loading resource DLL 'C:\Windows\CCM\1033\TSRES.DLL'
Taking ownership of TPM
uStatus == 0, HRESULT=80070005 (e:\nts_sccm_release\sms\framework\tscore\tpm.cpp,645)
pTpm->TakeOwnership( sOwnerAuth ), HRESULT=80070005 (e:\nts_sccm_release\sms\client\osdeployment\bitlocker\bitlocker.cpp,522)
InitializeTpm(), HRESULT=80070005 (e:\nts_sccm_release\sms\client\osdeployment\bitlocker\bitlocker.cpp,1313)
ConfigureKeyProtection( keyMode, pwdMode, pszStartupKeyVolume ), HRESULT=80070005 (e:\nts_sccm_release\sms\client\osdeployment\bitlocker\bitlocker.cpp,1552)
pBitLocker->Enable( argInfo.keyMode, argInfo.passwordMode, argInfo.sStartupKeyVolume, argInfo.bWait ), HRESULT=80070005 (e:\nts_sccm_release\sms\client\osdeployment\bitlocker\main.cpp,382)
'TakeOwnership' failed (2147942405)
Failed to take ownership of TPM. Ensure that Active Directory permissions are properly configured
ccess is denied. (Error: 80070005; Source: Windows)
0
write.csv(df,file="~C:/Users/anitha/Documents/social_media analysis/socialmedia/tweets.csv",row.names=FALSE,append = TRUE)
Error in file(file, ifelse(append, "a", "w")) :
  cannot open the connection
0
Its supposed to be a map guider an accurate gps for car by giving the accurate route through roads car must do.

underlined line is what debug shows it as wrong.

any other

using System;


using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Windows.Devices.Geolocation;
using Windows.Services.Maps;


// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409

namespace App75
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();

            button.Tapped += Button_Tapped;
        }

        private async void Button_Tapped(object sender, TappedRoutedEventArgs e)
        {
            BasicGeoposition b1 = new BasicGeoposition();

            b1.Latitude = Convert.ToDouble(startpositionlatitude.Text);

            b1.Longitude = Convert.ToDouble(startpositionlongitude.Text);

            BasicGeoposition b2 = new BasicGeoposition();
0
Hi,

I fairly new in R, I am doing some simple visualization in shiny app, I am trying to flip a bar chart downward using  scale_y_reverse() , it works well when I run my code in R console, but when I run it in shiny it does not flip the bar chart, below is my code in the server part:

output$trendbarPlot <- renderPlotly({
                              mydat <- mydatCopy %>% filter(Country ==input$Country)
                              

attacksbarplot = ggplot(data=mydat,aes(x=as.factor(Year))) + geom_bar() + theme_bw(base_size=35) + xlab("") + ylab("") + theme(axis.text.x = element_blank(), axis.ticks=element_blank(),panel.grid.major=element_blank(),panel.grid.minor=element_blank(),panel.border=element_blank())  + scale_y_reverse()


attacksbarplotnol = ggplot(data=mydat,aes(x=as.factor(Year))) + geom_bar() + theme_bw(base_size=15) + xlab("") + ylab("") + theme(axis.text.x = element_blank(), axis.text.y = element_blank(), axis.ticks=element_blank(),panel.grid.major=element_blank(),panel.grid.minor=element_blank(),panel.border=element_blank()) +  scale_y_reverse()
 
                              })

attached file has the required flipped bar chart in shiny.

Does anyone knows how can I solve this issue?
FlippedChart.png
0
Technology Partners: We Want Your Opinion!
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I'm building a news application. Each article can be tagged with words like "Politics", "Food", "San Jose, CA". I'd like users to be able to select a tag, and see all related articles. What would be the recommended way of storing this data?

My instinct is to use S3 for each news article and tag, and then to use DynamoDB to store the relationship of tag to article (edges). So, when a user wants to view articles for a tag, I'd retrieve the S3 object for that tag, do a DynamoDB query for the ID's of articles associated with that tag, and then retrieve the S3 objects for each article.

Does this sound like a good plan, or is there a better way?
0
My data:

Gage_number Latitude    Longitude   Date    Gage_1  Gage_2  Gage_3

1   35.02   -80.84  1/1/2002    0.23    0   0.7
2   35.03   -81.04  1/2/2002    0   0   0.2
3   35.06   -80.81  1/3/2002    3.2 2.1 0.1
This is just a subset of data. I around 50 gauge stations. I want to find spatial auto correction between my gauge stations for rain fall. Based on distance between them. I have created my distance matrix. But I don’t want to use any library in R. I want to do all steps in a function.

loc <- read.table("rain_data.txt",header=TRUE,fill=TRUE)  
gauge.dists <- as.matrix(dist(cbind(loc$Latitude, loc$Latitude))) #distance matrix
Now since distance between gauges is not uniform. I want to use a certain bin size to decide about distance lags.

Pseudocode:

If the distance between guage pair 1-2 is 1 meter then assign a distance lag of 1 and so on So Lag 1=intergage dist=1 meter. So Lag 5=intergage dist=5 meter After creating that matrix I will find autocorrelation between gauge pairs.

so for lag 1 intergage dist=1 for lag 5 intergage dist=5

Gage pair   date    RainA   RainB       Gage pair   date    RainA   RainB

1-2 1/1/2002    0.23    0       1-3 1/1/2002    0.23    0.7
1-2 1/2/2002    0   0       1-3 1/2/2002    0   0.2
1-2 1/3/2002    3.2 2.1     1-3 1/3/2002    3.2 0.1
I have a hard time translating it into loop or a function. Any ideas?
0
Hi,
I'm looking for an experienced Mac OS X kernel programmer. If are one, or if you know of one, please drop me a message.

Here are the basic details of the project:
- Build a driver to detect if the machine is connected to my proxy.
- If not, block all access to the Internet (disable the network adapter?).
- It should be tamper proof

Currently, a gross estimate will suffice.

p.s. We currently employ a Widows solution for the above, now we're looking to expand to Mac OS X too.
0
Using Chiro8000 version 14.4.0.2 and the program shut down today and will not open.  When I try to open the program, I get a message stating:   Root element is missing

Has anyone ever experienced this problem, and if so, how was it fixed?
0
I am bit new to R so I am not sure if this is possible or if its more difficult than I am assuming.

Objective: I want to find the correlation between Diagnosis codes. If patient #1 has condition X what the likelihood he will at some point also have condition Y as well.

Here is what I have:
136,337 Unique patient IDs (74,527 Female, 61,810 Male)
34,442 Unique Diagnosis that exists in my population
7,777,728 Unique observations

So my 2 questions are:
1. How should I layout my Table for R?
Right now I have the table columns as :
ID, SEX, Diagnosis

2. What should my Rscript look like in order to create correlation coefficients between all my diagnosis codes.  

FYI: Yes I also have a time stamp per diagnosis code but adding it now would be to adding more confusion to the confusion I already have.
0
hello guys iam working on making a software to connect to sabre API s from my program
but when I try to connect i have authorization issue i want to know how to connect to a Sabre API using Vb.net
0
I have 3 .bat files
Ab.bat
cd.bat
ef.bat

And I want to convert them in single file through "BATCH TO EXE converter" also they should run as a single file. Kindly help
0
--fact :: Integer -> Integer 
fact 0 = 1
fact n = n * fact (n-1)

func x i  = ( x^oddTerm / (fact oddTerm))    --Have to add fromIntegral here before (fact oddTerm)
                 where oddTerm = 2*i - 1

Open in new window


If I don't add fromIntegral in the place commented above, ghci would give me this error message while running func
    • Ambiguous type variable ‘a0’ arising from a use of ‘it’
      prevents the constraint ‘(Fractional a0)’ from being solved.
      Probable fix: use a type annotation to specify what ‘a0’ should be.
      These potential instances exist:
        instance Fractional Double -- Defined in ‘GHC.Float’
        instance Fractional Float -- Defined in ‘GHC.Float’
        ...plus one instance involving out-of-scope types
        (use -fprint-potential-instances to see them all)
    • In the first argument of ‘print’, namely ‘it’
      In a stmt of an interactive GHCi command: print it

Open in new window


And without adding fromIntegral, if I uncomment the first line, it would not even compile.
Any answer would be much appreciated.
0
So I would like to make this program read a user inputted matrix instead of the one that is provided in the main function. Also, the limit to the 2d matrix should be more than 9, but no more than about 100 and should also be user defined.

The main function purpose that I had in mind would be something like:
int main(){
    int graph[V][V];
  printf("Enter number of towns: ");
  scanf("%d", V);
  printf("Enter distance matrix");
  scanf("%d", graph[V][V]);
  dijkstra(graph, 0);
return 0;}

Open in new window

which is giving me a great headache trying to write.. Any help would be greatly appreciated. Thank you.


// A C / C++ program for Dijkstra's single source shortest path algorithm.
// The program is for adjacency matrix representation of the graph
  
#include <stdio.h>
#include <limits.h>
  
// Number of vertices in the graph
#define V 9
  
// A utility function to find the vertex with minimum distance value, from
// the set of vertices not yet included in shortest path tree
int minDistance(int dist[], bool sptSet[])
{
   // Initialize min value
   int min = INT_MAX, min_index;
  
   for (int v = 0; v < V; v++)
     if (sptSet[v] == false && dist[v] <= min)
         min = dist[v], min_index = v;
  
   return min_index;
}
  
// A utility function to print the constructed distance array
int printSolution(int dist[], int n)
{
   printf("Vertex   Distance from Source\n");
   for (int i = 0; i < V; i++)
      printf("%d \t\t %d\n", i, dist[i]);
}
  
// Funtion that 

Open in new window

0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I work for the New Zealand Fire Service, and part of my role is to keep situational awareness over the region I cover.  I had the idea of making an automated tool that constantly monitored parameters and would give a notification when they exceed a threshold.  For instance, wind speeds, river levels, rain accumulation, traffic updates, temperature, relative humidity... many things!

Most of these things are available through websites, but do require me to physically look at them.  I had created a trial of my idea in Excel - it would open instances of IE and scrape the HTML on the page to retrieve certain numbers. I could tell it to check every 15 minutes or hour or whatever is suitable.

However, it doesn't seem like Excel would be a suitable platform to fully develop this... and finding various bits of HTML out of a page is prone to breaking, but may be my only option unless there is some kind of database access for these numbers.

Has anyone got any ideas on the best way I can make my idea happen? I'm assuming there would be something web-based I could do that could be doing something similar?
0
need to select recs. from GL database file that contains  a 4 position year and 2 position period fields.
Have to select across multiple years/periods ex. 2015 period 9 thru 2017 period 8.
Would like to take advantage of concatenating the fields using OPNQRY so that I can use the qryslt to select year/period range.
0
Hi Experts,

I am trying to generate a GS1-128 barcode string and I am having the issues with the check digit. My barcode has combination of subset B and C. I have tried to calculate based on calculations given in some websites. But I am not getting correct check digit.

Below mentioned are the examples of my barcodes.

40327641468+99000952123001
40327605999+99000900000000

Example of combination of subsets: Start C  FCN1  '4032764146'  Set B  '8+'  Set C '9900095212300'

Please help me how to calculate the check digit manually.
0
Hello, from a sys admin i have become a Data Entry operator so I am just wondering is there is an easy way to accomplish the following:

I have an spreadsheet with 112 records and the following headers and values:

"Full Name" "DOB", "Delegate Code"
LASTNAME, FIRSTNAME mm/dd/yyyy 12345

Open in new window


Then i go to a website completely external to us, i am using firefox. And the web page has the following text boxes that i need to fill in
Last Name: [Text box]
Delegate Code: [Text box]
Funtions:  
[]Care Management - Submit Resubmit Authorization
[]Care Management - View Authorization
[]Claim - Inquiry
[]Claim - Submit and Resubmit
[]Notify Me
[]Provider Maintenance
[]Resources - Download Reports
[]Resources - Search HIPAA Error Codes
[]Revalidation
[]Search Accounts Receivable
[]Search Alerts
[]Search Payment History
[]Secure Correspondence
[]Verify Eligibility

But we have to select Care Management - Submit Resubmit Authorization, Care Management - View Authorization,Claim - Inquiry,Claim - Submit and Resubmit, Resources - Download Reports, Resources - Search HIPAA Error Codes, Search Accounts Receivable, Search Alerts, Search Payment History and Verify Eligibility

And, hit the Submit button

Open in new window

Is this possible to automate ?

Thanks for your help
0
Can we open outlook web application using selenium webdriver?

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;



public class test {
	
	
public static void main(String[] args) {
	
	 WebDriver driver;
	 
	System.setProperty("webdriver.ie.driver","**.exe");
	driver=new InternetExplorerDriver();
	driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);

	driver.get("***");

Open in new window


As per the requirement I need to open google.com and then open outlook web application. Using the above code google can be opened.
Could you please help me with the code to open outlook application.
0
Am currently creating MS. Access application with these table of interest Students, Assessments, Subjects and Year. I would like to create batch IAs and Exams entry form, where I wouldn't have to enter the same subject and year for similar records one after the other.
I want to be be able to create combo box for Students class and  subject. Other fields like 30% and 70% would entered manually by tutors. Thanks For Contributions and Help In advance.
0

R

79

Solutions

5

Articles & Videos

209

Contributors

R is a programming language and environment used primarily for statistical data analysis.

Top Experts In
R
<
Monthly
>