Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7748383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:46:17+00:00 2026-06-01T10:46:17+00:00

When I do: import rpy2.robjects as R exampleDict = {‘colum1’:R.IntVector([1,2,3]), ‘column2’:R.FloatVector([1,2]), ‘column3’:R.FloatVector([1,2,3,4])} R.DataFrame(exampleDict) I

  • 0

When I do:

import rpy2.robjects as R
exampleDict = {'colum1':R.IntVector([1,2,3]), 'column2':R.FloatVector([1,2]), 'column3':R.FloatVector([1,2,3,4])}
R.DataFrame(exampleDict)

I get the error that the rows are not of the same lenghts: “arguments imply differing number of rows: 2, 4, 3”.

How I solved it before is to loop through the lists before making them vectors and adding NA to all the lists that are smaller than the longest until they are all of the same length.

Is there an easy way of making a dataframe with rpy2 with different column lengths?


edit: I tried

myparams = {'na.rm': True}
R.DataFrame(exampleDict, **myparams)

but R.DataFrame only accepts one argument.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:46:18+00:00Added an answer on June 1, 2026 at 10:46 am

    As Igautier said, it was answered on the rpy mailing-list. It can’t be done. So I keep to my workaround of adding NA_Reals and NA_Ints to the vectors that are smaller than the largest vector before making a dataframe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using rpy2 for regressions. The returned object has a list that includes
Here's what should and does happen using rpy2.robjects.packages.importr for base R-packages (e.g. stats ):
how to configure Sweave it's work and recognize for Rpy2? I use this import
import numpy as np a = np.arange(1000000).reshape(1000,1000) print(a**2) With this code I get this
import com.mockobjects.sql.*; The above line creates the error The import com.mockobjects.sql cannot be resolved
import sys sys.path.append('/home/myuser/svn-repos/myproject') from myproject.settings import * But, it says module not found when
import java.util.Collection; import example.Event; public interface Query { public boolean hasMore (); public Collection<Event>
import java.lang.Math; public class NewtonIteration { public static void main(String[] args) { System.out.print(rootNofX(2,9)); }
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class DateDemo { public static void main(String[]
import threading event = threading.Event() event.set() print event.wait(1) None event.clear() print event.wait(1) None So

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.